Sublime Forum

Zipped package - file access

#1

Hi

  1. for my plugin to work you need to have a certain file in opened folder
  2. this file has some default contents so one does not have to remember it (JSON / sublime-settings, but with comments)
  3. I used to let it be created by having a default file in a package directory and copy it to target folder

However I found out, that plugins can also be compressed as .sublime-package - what would be the best solution for this issue?
I honestly can’t imagine anything not awkward (like having a huge hardcoded string variable in a module)

I don’t think I can use JSON tools as the file needs to have comments (I strip them before parsing, but for user to see)

Thank you

0 Likes

#2

Well this Force Extract .sublime-package Archive into Packages folder might be a solution…

0 Likes

#3

You can use the sublime.load_resource(‘Packages/Default/Main.sublime-menu’) API, which will load the given file irrespective of if it’s on the file system or in a .sublime-package file

0 Likes

#4

Thank you! I’ll give it a try

0 Likes