diff options
author | Robert Bieber <robby@bieberphoto.com> | 2010-07-05 20:38:04 +0000 |
---|---|---|
committer | Robert Bieber <robby@bieberphoto.com> | 2010-07-05 20:38:04 +0000 |
commit | ac58d02ceef534ef3a42c8d40ac106f1943f351d (patch) | |
tree | 99353c14a9f90fd64e6c5358ad6fcf63db98c4d1 /utils/themeeditor/addresourcedir.php | |
parent | 4158192975728d0c00212ae09844e7e295b98ab0 (diff) | |
download | rockbox-ac58d02ceef534ef3a42c8d40ac106f1943f351d.tar.gz rockbox-ac58d02ceef534ef3a42c8d40ac106f1943f351d.zip |
Theme Editor: Added a small PHP script to auto-generate a qrc entry for a directory with aliases for each file
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@27298 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'utils/themeeditor/addresourcedir.php')
-rwxr-xr-x | utils/themeeditor/addresourcedir.php | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/utils/themeeditor/addresourcedir.php b/utils/themeeditor/addresourcedir.php new file mode 100755 index 0000000000..3c2ac33f04 --- /dev/null +++ b/utils/themeeditor/addresourcedir.php | |||
@@ -0,0 +1,46 @@ | |||
1 | #!/usr/bin/php -q | ||
2 | <?php | ||
3 | /*************************************************************************** | ||
4 | * __________ __ ___. | ||
5 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
6 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
7 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
8 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
9 | * \/ \/ \/ \/ \/ | ||
10 | * $Id$ | ||
11 | * | ||
12 | * Copyright (C) 2010 Robert Bieber | ||
13 | * | ||
14 | * This program is free software; you can redistribute it and/or | ||
15 | * modify it under the terms of the GNU General Public License | ||
16 | * as published by the Free Software Foundation; either version 2 | ||
17 | * of the License, or (at your option) any later version. | ||
18 | * | ||
19 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | ||
20 | * KIND, either express or implied. | ||
21 | * | ||
22 | ****************************************************************************/ | ||
23 | |||
24 | if($argc < 2) | ||
25 | $path = getcwd(); | ||
26 | else | ||
27 | $path = $argv[1]; | ||
28 | if($path[count($path) - 1] != '/') | ||
29 | $path = $path . '/'; | ||
30 | $dir = dir($path); | ||
31 | $split = explode("/", $path); | ||
32 | $last = $split[count($split) - 2]; | ||
33 | echo "\t<qresource prefix=\"/$last\">\n"; | ||
34 | while(false !== ($entry = $dir->read())) | ||
35 | { | ||
36 | if($entry == '.' || $entry == '..') | ||
37 | continue; | ||
38 | echo "\t\t"; | ||
39 | echo "<file alias = \"$entry\">"; | ||
40 | echo $path . $entry . "</file>"; | ||
41 | echo "\n"; | ||
42 | } | ||
43 | echo "\t</qresource>\n"; | ||
44 | $dir->close(); | ||
45 | |||
46 | ?> | ||