Skip to content
This repository was archived by the owner on May 19, 2021. It is now read-only.

Commit f2ce747

Browse files
committed
add registry folder if missing fixes #65
1 parent 394c1cd commit f2ce747

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

UnityLauncher/Tools.cs

+8-2
Original file line numberDiff line numberDiff line change
@@ -224,6 +224,13 @@ public static void RemoveContextMenuRegistry(string contextRegRoot)
224224
public static void AddContextMenuRegistry(string contextRegRoot)
225225
{
226226
RegistryKey key = Registry.CurrentUser.OpenSubKey(contextRegRoot, true);
227+
228+
// add folder if missing
229+
if (key == null)
230+
{
231+
key = Registry.CurrentUser.CreateSubKey(@"Software\Classes\Directory\Background\Shell");
232+
}
233+
227234
if (key != null)
228235
{
229236
var appName = "UnityLauncher";
@@ -238,11 +245,10 @@ public static void AddContextMenuRegistry(string contextRegRoot)
238245
var executeString = "\"" + Application.ExecutablePath + "\"";
239246
executeString += " -projectPath \"%V\"";
240247
key.SetValue("", executeString);
241-
//SetStatus("Added context menu registry items");
242248
}
243249
else
244250
{
245-
//SetStatus("Error> Cannot find registry key: " + contextRegRoot);
251+
Console.WriteLine("Error> Cannot find registry key: " + contextRegRoot);
246252
}
247253
}
248254

0 commit comments

Comments
 (0)