Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

show_game_files command not working on linux #851

Closed
LeafyLuigi opened this issue Jun 14, 2022 · 4 comments
Closed

show_game_files command not working on linux #851

LeafyLuigi opened this issue Jun 14, 2022 · 4 comments
Assignees
Labels
bug This is an unintended error or behavior that can be addressed with specific development changes.
Milestone

Comments

@LeafyLuigi
Copy link

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

@Pathoschild Pathoschild self-assigned this Jul 7, 2022
@Pathoschild Pathoschild added the bug This is an unintended error or behavior that can be addressed with specific development changes. label Jul 7, 2022
@Pathoschild Pathoschild added this to the 3.15.1 milestone Jul 7, 2022
@Pathoschild
Copy link
Owner

Pathoschild commented Jul 7, 2022

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 Pathoschild removed this from the 3.15.1 milestone Jul 7, 2022
@Mixone-FinallyHere
Copy link

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 )

@Pathoschild
Copy link
Owner

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.

jakerosado added a commit to jakerosado/SMAPI that referenced this issue Oct 13, 2023
Built-in commands "show_game_files" and "show_data_files" now open
system file dialogs for *nix based systems. The fix is system-agnostic
and works on Windows as well.

Resolves: Pathoschild#851
@Pathoschild Pathoschild added this to the 4.1.x milestone Jul 6, 2024
@Pathoschild
Copy link
Owner

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!

Pathoschild pushed a commit that referenced this issue Jul 7, 2024
Built-in commands "show_game_files" and "show_data_files" now open
system file dialogs for *nix based systems. The fix is system-agnostic
and works on Windows as well.

Resolves: #851
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug This is an unintended error or behavior that can be addressed with specific development changes.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants