RubyStartup parameter does not work with unicode characters

Below command line should start SketchUp, load the file MyFile.skp and run the script MyScript.rb, but the script is not run because of the letter ś :

“C:\Program Files\SketchUp\SketchUp 2022\SketchUp.exe” “F:\MyFile.skp” -RubyStartup “C:\DominikaGraboś\MyScript.rb”

I hope this can be fixed, as it is a critical part of the way we create interaction with our GIS software:

ping @tt_su @ChrisFullmer @colin


@jon5 Just wondering if the script is located in the user’s path would using a replaceable parameter work ? Ie …

"C:\Program Files\SketchUp\SketchUp 2022\SketchUp.exe"
 "F:\MyFile.skp" -RubyStartup "%USERPROFILE%/MyScript.rb"

Can you log this in the issue tracker please?

A potential workaround could perhaps be to change the current working directory before launching SketchUp and use a relative path to “MyScript.rb”?

Another workaround could be to save the path in the text file in a non-unicode location and pass the path to that textfile to your script.

Yes, the script is in the users path. I just tried your idea, but unfortunately is is not working.

Sure, I’ll add it to the Issue Tracker.
I had hope for the working directory idea, but it does not work. Looks like SketchUp is changing the folder to /SketchUp/Plugins on startup.
I need to make this work seamlessly and not needing to ask the user for a non-unicode path for these “behind the scene” things. I will make it possible to change the path used, as a hidden(registry) feature in our software, so we can help the few having problems. Still it would be better if the issue was fixed, I guess it is simple. Strangely enough it is possible add a project file as parameter to open it even if the path contains non-unicode parameters, so in that much more common case, it is handled correctly.
Thanks for the ideas for workarounds anyway!

It may be, but by the end of the load cycle the current working directory should be set to the user’s “Documents” path since SU v2014 or so.

That’s interesting.
I got this in 2021 just after open empty project:
Dir.pwd
C:/Users/jon/AppData/Roaming/SketchUp/SketchUp 2021/SketchUp/Plugins

Then I disabled all my extensions, and then I got this:
Dir.pwd
C:/Users/jon/Documents

I guess extensions can be both a blessing and a curse :slight_smile:

Yes, apparently whilst the “Plugins” path is being processed (extensions loaded) it is set as the working directory. Then when loading is complete it’s changed to the user “Documents” path.

This is why our code should never assume what the working directory will be. We’ve long advocated that the block form of the Dir::chdir be used to temporarily change the working directory and have it automatically restored when the block returns. Ie …

Dir.chdir(my_path) do 
  # code
end
# previous working directory is restored

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.