SMAPI - Stardew Modding API

SMAPI - Stardew Modding API

971k Downloads

show_game_files command not working on linux

LeafyLuigi opened this issue ยท 4 comments

commented

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

commented

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.

commented

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 )

commented

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.

commented

This should be fixed via #916 for the upcoming SMAPI 4.1.0. Let me know if it still happens when you get that update. Thanks for reporting it!