rejetto forum

programmatically add/create .vfs file

Guest · 7 · 3498

0 Members and 1 Guest are viewing this topic.

hutnut

  • Guest
Is there a way to programmatically add entries to the .vfs file. I'd like to create a folder in an application and dynamically alter the .vfs file to support this new folder. A cursory look at the the .vfs file looks proprietary. Am I missing something or are there other options?


Offline rejetto

  • Administrator
  • Tireless poster
  • *****
    • Posts: 13510
    • View Profile
from your application just run:
hfs <fullpath-path-to-the-folder-you-want-to-add>


hutnut

  • Guest
Thanks. This solution does add the given folder to HFS but immediately prompts the user as to whether this is a virtual or real folder. Can this prompt be avoided.


Offline Wasserfloh

  • Occasional poster
  • *
    • Posts: 81
    • View Profile


hutnut

  • Guest
When adding this new folder, can I give it a different name dynamically? For example, give c:\test1\patchfiles a name of "test1" and give c:\test2\patchfiles a name of "test2". I can perform a rename via the UI but can I do it programmatically. Thanks.


Offline rejetto

  • Administrator
  • Tireless poster
  • *****
    • Posts: 13510
    • View Profile
the scripting language is able to do this.
there's a command called "add folder".
read more at http://www.rejetto.com/wiki/index.php/HFS:_scripting_commands#Virtual_File_System_manipulation

at the moment there's no designed way to run a script at command line, it will come in future versions.
that's how you can workaround this:
- create a virtual folder called "whatyouwant" (consider hiding it)
- right click on it > properties > diff template
- put your script there, and you will be able to call this script by accessing url http://localhost/~whatyouwant

if you don't know how to access the url at command line, download an utility like wget, so that you can just run: wget http:/etcetcetc

at this point, only left problem is to communicate the path and possibly other stuff.
a good option would be if the script determines this data itself, and there's no need to communicate.
otherwise, the easiest way would be to add your data to the url, when calling through
wget http://localhost/~whatyouwant?path=C:\test&trueName=foo
you will access path and trueName in the script through {.?path.} and {.?trueName.}