Skip to content

Commit b3c5368

Browse files
committed
Refactoring, fix start process on OSX
1 parent eaa70a0 commit b3c5368

File tree

1 file changed

+14
-9
lines changed

1 file changed

+14
-9
lines changed

Assets/PatchKit Patcher/Scripts/Debug/DebugMenu.cs

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ private IEnumerator SetUserDecision(Patcher.UserDecision userDecision)
131131
Close();
132132
}
133133

134-
void OpenFile(string path, bool isFile)
134+
void OpenFileSystemEntry(string path, bool isFile)
135135
{
136136
if (File.Exists(path) || Directory.Exists(path))
137137
{
@@ -159,11 +159,11 @@ private void OpenLauncherLogFileLocation()
159159
#else
160160
#if UNITY_STANDALONE_OSX
161161
string logDirectoryPath = Patcher.Instance.Data.Value.LockFilePath.Replace(
162-
Patcher.Instance.AppSecret + Path.DirectorySeparatorChar + ".lock", "");
162+
GetHashAppSecret(Patcher.Instance.AppSecret) + Path.DirectorySeparatorChar + ".lock","");
163163
#else
164164
string logDirectoryPath = Patcher.Instance.Data.Value.LockFilePath.Replace(".lock","");
165165
#endif
166-
OpenFile(logDirectoryPath, false);
166+
OpenFileSystemEntry(logDirectoryPath, false);
167167
#endif
168168
}
169169

@@ -174,14 +174,20 @@ private void OpenLauncherLogFile()
174174
#else
175175
#if UNITY_STANDALONE_OSX
176176
string logPath = Patcher.Instance.Data.Value.LockFilePath.Replace(
177-
Patcher.Instance.AppSecret + Path.DirectorySeparatorChar + ".lock", "launcher-log.txt");
177+
GetHashAppSecret(Patcher.Instance.AppSecret) + Path.DirectorySeparatorChar + ".lock",
178+
"launcher-log.txt");
178179
#else
179180
string logPath = Patcher.Instance.Data.Value.LockFilePath.Replace(".lock","launcher-log.txt");
180181
#endif
181-
OpenFile(logPath, true);
182+
OpenFileSystemEntry(logPath, true);
182183
#endif
183184
}
184185

186+
public string GetHashAppSecret(string appSecret)
187+
{
188+
return appSecret.Substring(0, 8);
189+
}
190+
185191
private void OpenPatcherLogFileLocation()
186192
{
187193
#if UNITY_EDITOR
@@ -207,7 +213,7 @@ private void OpenPatcherLogFileLocation()
207213
#endif
208214
#endif
209215
#endif
210-
OpenFile(logDirectoryPath, false);
216+
OpenFileSystemEntry(logDirectoryPath, false);
211217
}
212218

213219
private void OpenPatcherLogFile()
@@ -240,7 +246,7 @@ private void OpenPatcherLogFile()
240246
#endif
241247
#endif
242248
#endif
243-
OpenFile(logPath, true);
249+
OpenFileSystemEntry(logPath, true);
244250
}
245251

246252
void DrawPopup(int id)
@@ -279,11 +285,10 @@ private ProcessStartInfo GetProcessStartInfo(string executablePath)
279285
WorkingDirectory = workingDir
280286
};
281287
case PlatformType.OSX:
282-
283288
return new ProcessStartInfo
284289
{
285290
FileName = "open",
286-
Arguments = string.Format("\"{0}", executablePath),
291+
Arguments = string.Format("\"{0}\"", executablePath),
287292
WorkingDirectory = workingDir
288293
};
289294
case PlatformType.Linux:

0 commit comments

Comments
 (0)