root/trunk/examples/behavior/resources.d

Revision 17, 0.8 kB (checked in by bobef, 4 years ago)

Updated to HTMLayout 3.2.2.8 and added a new example (see change log for more details)

Line 
1 import tango.io.File;
2 import tango.io.FilePath;
3 import tango.io.FileSystem;
4 import tango.io.FileConduit;
5 import tango.io.GrowBuffer;
6 import tango.io.Stdout;
7 import tango.text.Util;
8 import flowerd.common;
9 import flowerd.config;
10 import crypto;
11
12 void main(char[][] argv)
13 {
14     if(argv.length<3) {Stdout("too few arguments");return;}
15     char[] source=FileSystem.getDirectory()~argv[1];
16     auto buf=new GrowBuffer(256*1024,512*1024);
17     auto cfg=new Config;
18    
19     bool scanner(FilePath path, bool dir)
20     {
21         if(dir) path.toList(&scanner);
22         else
23         {
24             char[] rel;
25             getRelativePath(source,path.toString,rel);
26             cfg.set(substitute(rel,"\\","/"),cast(char[])File(path.toString).read,ConfigNode.BINARY);
27         }
28         return true;
29     }
30
31     FilePath(source).toList(&scanner);
32
33     cfg.save(argv[2]);
34 }
Note: See TracBrowser for help on using the browser.