Home Download Buy Blog Forum Support

Zipped package - file access

Zipped package - file access

Postby NoxArt on Tue Jul 23, 2013 8:14 pm

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
NoxArt
 
Posts: 14
Joined: Mon Jan 30, 2012 9:05 pm

Re: Zipped package - file access

Postby NoxArt on Tue Jul 23, 2013 10:36 pm

Well this viewtopic.php?f=6&t=13427 might be a solution...
NoxArt
 
Posts: 14
Joined: Mon Jan 30, 2012 9:05 pm

Re: Zipped package - file access

Postby jps on Wed Jul 24, 2013 6:22 am

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
jps
Site Admin
 
Posts: 3062
Joined: Wed Mar 19, 2008 12:33 pm

Re: Zipped package - file access

Postby NoxArt on Wed Jul 24, 2013 12:31 pm

Thank you! I'll give it a try
NoxArt
 
Posts: 14
Joined: Mon Jan 30, 2012 9:05 pm


Return to Plugin Development

Who is online

Users browsing this forum: Google [Bot] and 5 guests