Sublime Forum

Default directory hidden on windows?

#1

As the question suggests, is the Default directory hidden on windows ? View Package File is able to open any files in Default but when I try window.open_file(sublime.packages_path() + "\\Default\\exec.py") it just opens an empty view with the following message in the console.

Unable to open /C/Users/user/AppData/Roaming/Sublime Text 3/Packages/Default/exec.py

Why is that ?

0 Likes

#2

Because sublime.packages_path() points to loosen user packages in the %appdata% directory while the builtin ones are located in os.path.join(os.path.dirname(sublime.executable_path()), "Packages")

0 Likes

#3

I still get the same message in the console though

Unable to open /C/Program Files/Sublime Text 3/Packages/Default/exec.py
0 Likes

#4

Sure. It’s because the Default package is zipped and shipped as Default.sublime-package, while window.open_file() is not designed to support opening files located in archives/sublime-packages.

0 Likes

#5

So is there a way to read the files in the .sublime-package file, by unzipping perhaps ?

0 Likes

#6

You could try window.run_command("open_file", {"file": "${packages}/Default/exec.py"}) instead.

1 Like

#7

Yes. That worked nicely. Thanks

0 Likes