diff --git a/AM2RLauncher/AM2RLauncher/CrossPlatformOperations.cs b/AM2RLauncher/AM2RLauncher/CrossPlatformOperations.cs
index 3737ae0..37ad89d 100644
--- a/AM2RLauncher/AM2RLauncher/CrossPlatformOperations.cs
+++ b/AM2RLauncher/AM2RLauncher/CrossPlatformOperations.cs
@@ -202,11 +202,32 @@ namespace AM2RLauncher
if (!Directory.Exists(realPath))
Directory.CreateDirectory(realPath);
+ //needs quotes otherwise paths with space wont open
if (currentPlatform.IsWinForms)
// And we're using explorer.exe to prevent people from stuffing system commands in here wholesale. That would be bad.
- Process.Start("explorer.exe", realPath);
+ Process.Start("explorer.exe", $"/select \"{realPath}\"");
+ // linux only opens the directory bc opening and selecting a file is pain
else if (currentPlatform.IsGtk)
- Process.Start("xdg-open", $"\"{realPath}\""); //needs quotes otherwise paths with space wont open
+ Process.Start("xdg-open", $"\"{realPath}\"");
+ }
+
+ ///
+ /// Opens and selects it in a file explorer.
+ ///
+ /// Path to open.
+ public static void OpenFolderAndSelectFile(string path)
+ {
+ // We have to replace forward slashes with backslashes here on windows because explorer.exe is picky...
+ string realPath = currentPlatform.IsWinForms ? Environment.ExpandEnvironmentVariables(path).Replace("/", "\\") : path.Replace("~", Environment.GetEnvironmentVariable("HOME"));
+ if (!File.Exists(realPath))
+ return;
+
+ //needs quotes otherwise paths with spaces wont open
+ if (currentPlatform.IsWinForms)
+ // And we're using explorer.exe to prevent people from stuffing system commands in here wholesale. That would be bad.
+ Process.Start("explorer.exe", $"/select, \"{realPath}\"");
+ else if (currentPlatform.IsGtk)
+ Process.Start("xdg-open", $"\"{Path.GetDirectoryName(realPath)}\"");
}
///
diff --git a/AM2RLauncher/AM2RLauncher/MainForm/MainForm.Methods.cs b/AM2RLauncher/AM2RLauncher/MainForm/MainForm.Methods.cs
index 4707c65..fd1c9c4 100644
--- a/AM2RLauncher/AM2RLauncher/MainForm/MainForm.Methods.cs
+++ b/AM2RLauncher/AM2RLauncher/MainForm/MainForm.Methods.cs
@@ -623,7 +623,7 @@ namespace AM2RLauncher
HelperMethods.DeleteDirectory(tempDir);
- CrossPlatformOperations.OpenFolder(CrossPlatformOperations.CURRENTPATH);
+ CrossPlatformOperations.OpenFolderAndSelectFile(CrossPlatformOperations.CURRENTPATH + "/" + profile.Name + ".apk");
log.Info("Successfully created Android APK for profile " + profile.Name + ".");
}