SMAPI icon indicating copy to clipboard operation
SMAPI copied to clipboard

show_game_files command not working on linux

Open LeafyLuigi opened this issue 2 years ago • 3 comments

show_game_files command seems to error on linux (and likely macos too)

the install directory is usually located at ~/.local/share/Steam/steamapps/common/Stardew Valley/, as are most steam games on linux

To Reproduce 0. be on linux

  1. run command show_game_files
  2. error

below is a screenshot of the log and was the only command ran https://i.imgur.com/NT2UMWX.png

LeafyLuigi avatar Jun 14 '22 14:06 LeafyLuigi

I took a quick look using this code from StackOverflow, which is supposed to work crossplatform:

Process.Start(new ProcessStartInfo
{
    FileName = Constants.GamePath,
    UseShellExecute = true,
    Verb = "open"
});

Unfortunately that fails with a different error:

System.ComponentModel.Win32Exception (2): No such file or directory
   at System.Diagnostics.Process.ForkAndExecProcess(String filename, String[] argv, String[] envp, String cwd, Boolean redirectStdin, Boolean redirectStdout, Boolean redirectStderr, Boolean setCredentials, UInt32 userId, UInt32 groupId, UInt32[] groups, Int32& stdinFd, Int32& stdoutFd, Int32& stderrFd, Boolean usesTerminal, Boolean throwOnNoExec)
   at System.Diagnostics.Process.StartCore(ProcessStartInfo startInfo)
   at System.Diagnostics.Process.Start()
   at System.Diagnostics.Process.Start(ProcessStartInfo startInfo)
   at StardewModdingAPI.Mods.ConsoleCommands.Framework.Commands.Other.ShowGameFilesCommand.Handle(IMonitor monitor, String command, ArgumentParser args) in /home/pathoschild/git/SMAPI/src/SMAPI.Mods.ConsoleCommands/Framework/Commands/Other/ShowGameFilesCommand.cs:line 24
   at StardewModdingAPI.Framework.SCore.OnPlayerInstanceUpdating(SGame instance, GameTime gameTime, Action runUpdate) in /home/pathoschild/git/SMAPI/src/SMAPI/Framework/SCore.cs:line 600

I'm not sure how to open a folder from C# on Linux currently, but I'll keep this open to look into it some more in future versions.

Pathoschild avatar Jul 07 '22 00:07 Pathoschild

have you tried a wrapper around the file handle and launching that as process instead of directly opening via Process? (stoverflow ref: c-sharp-under-linux-process-start-exception-of-no-such-file-or-directory )

Mixone-FinallyHere avatar Jul 15 '22 09:07 Mixone-FinallyHere

In this case we want to open a folder window, instead of running a script file. Do you mean creating a bash script that opens the folder, and calling that from the C# code? There doesn't seem to be a consistent way to open a GUI folder from bash on Linux unfortunately.

Pathoschild avatar Jul 16 '22 15:07 Pathoschild