Skip to content

Commit f6adcf6

Browse files
committed
Fix #83
1 parent 04d5468 commit f6adcf6

File tree

2 files changed

+29
-14
lines changed

2 files changed

+29
-14
lines changed

MOD.Scripts.UI/MODActions.cs

+28-13
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,18 @@ private static void TryRedrawTextWindowBackground(WindowFilterType filterType)
4646
GameSystem.Instance.MainUIController.TryRedrawTextWindowBackground(windowFilterTextureName);
4747
}
4848

49+
private static string ExpandHome(string s)
50+
{
51+
if (s.Length > 0 && s.StartsWith("~"))
52+
{
53+
return Environment.GetEnvironmentVariable("HOME") + s.Remove(0, 1);
54+
}
55+
else
56+
{
57+
return s;
58+
}
59+
}
60+
4961
/// <summary>
5062
/// Cycles and saves Console->MangaGamer->OG->Custom->Console...
5163
/// </summary>
@@ -417,7 +429,7 @@ public static string GetLogFolder()
417429
{
418430
// Higurashi 1-7 use the "HigurashiEp01_Data", which is one folder above the streamingAssets folder
419431
// eg. C:\games\Steam\steamapps\common\Higurashi When They Cry\HigurashiEp01_Data, where log file would be output_log.txt
420-
return MODUtility.CombinePaths(Application.streamingAssetsPath, "..");
432+
return MODUtility.CombinePaths(Application.streamingAssetsPath, "..\\");
421433
}
422434

423435
//eg. ~/Library/Logs/Unity, where log file would be Player.log
@@ -441,28 +453,31 @@ public static void ShowSaveFolder()
441453
{
442454
ShowFile(MGHelper.GetSavePath());
443455
}
456+
public static void ShowCompiledScripts()
457+
{
458+
ShowFile(Path.Combine(Application.streamingAssetsPath, "CompiledUpdateScripts"));
459+
}
444460

445461
//NOTE: paths might not open properly on windows if they contain backslashes
446462
public static void ShowFile(string path)
447463
{
448-
Assets.Scripts.Core.Logger.Log($"MOD ShowFile(): Showing [{path}]");
449464
try
450465
{
451-
switch (MODUtility.GetPlatform())
452-
{
453-
case MODUtility.Platform.Windows:
454-
default:
455-
Process.Start("explorer", path.Replace('/', '\\'));
466+
switch (MODUtility.GetPlatform())
467+
{
468+
case MODUtility.Platform.MacOS:
469+
case MODUtility.Platform.Linux:
470+
path = ExpandHome(path.Replace('\\', '/'));
456471
break;
457472

458-
case MODUtility.Platform.MacOS:
459-
Process.Start("open", path.Replace('\\', '/'));
460-
break;
461-
462-
case MODUtility.Platform.Linux:
463-
Process.Start("xdg-open", path.Replace('\\', '/'));
473+
case MODUtility.Platform.Windows:
474+
default:
475+
path = path.Replace('/', '\\');
464476
break;
465477
}
478+
479+
Assets.Scripts.Core.Logger.Log($"MOD ShowFile(): Showing [{path}]");
480+
Application.OpenURL(path);
466481
}
467482
catch(Exception e)
468483
{

MOD.Scripts.UI/MODMenuSupport.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ public static void ShowSupportButtons(Func<GUIContent, bool> buttonRenderer)
6464
"You can manually clear the *.mg files (compiled scripts) in this folder to force the game to regenerate them the next time the game starts.\n\n" +
6565
"Please be aware that the game will freeze for a couple minutes on a white screen, while scripts are being compiled.")))
6666
{
67-
Application.OpenURL(System.IO.Path.Combine(Application.streamingAssetsPath, "CompiledUpdateScripts"));
67+
MODActions.ShowCompiledScripts();
6868
}
6969

7070

0 commit comments

Comments
 (0)