New addon : Project Folder

Hi!

This is another script. It is really as simple as it is useful.

It’s only a new operator that opens the project directory in which the .blend file is saved, but open inside the OS file browser. So it is a quick and direct access to the project folder from the “file” menu.

Here is the tracker’s project page (you can get it from the attachment section):

http://projects.blender.org/tracker/index.php?func=detail&aid=25910

But there is a problem. Right now, the addon only works on Windows. So I will need some help on other systems.

  • Linux

I tried it once, it didn’t work. The reason is that I use os.startfile() with the project directory as an argument. When giving a directory to startfile() it opens explorer at this directory. But startfile() did not exist in the “os” module from the linux version. Anyway, on a linux system, there is many file browsers and we can’t say what one wille be on the user’s system. So, is there an environment variable that gives the default file browser of the system? Or, is there another python module/fuction that does the same as os.startfile()? Anyway, I don’t have a linux system right now, so any help would be welcome to make it work on linux.

  • Mac

I know nothing about mac and do not own any. So I need someone to try first if it works on a mac. If not than I am in the need of a collaborator also here.

Any help, feedback is welcome. If you find it useful in your workflow but would miss something to really fit, feel free to give some details.

Thank you!

Hey this is very very handy man! i am installing it right now to my daily use

Thanks Axon

Thank you for the feedback.

I am still hoping for someone to try it on a mac.

Macs have an open <path> command. instead of os.startfile(…), the command might be something more like:


a = os.popen( 'open \"' + path + '\"' )
a.close()

i just tested this in the >>> and it worked. notice the escaped double quotes. they make it handle files with spaces.

popen’s return value is basically useless here, so variable a is just a placeholder.
This will fail for other *nix systems where the shell has no ‘open’ commend, but the same method will probably apply. for gnome its probably gonna look like os.popen(‘nautilus -someflagicantremember "’ + path + ‘"’)

SVN (W32 Vista)
gives this error:
search for unknown operator FILE_OT_project_folder, file.project_folder ???

@Dustractor
Thank you for the info. Now I use popen() instead of startfile() for windows also. It sould work for mac but as I haven’t one, I would really appreciate if you could test it again. Or someone else.

@PKHG
Thank you for the report. The api has big changes these days. It should work now.

Here is the new version working for at least revision 34995 :
http://projects.blender.org/tracker/download.php/153/467/25910/15074/system_project_folder.py

I hope it works on mac!

Still don’t work for *nix.