diff options
author | Franklin Cooper Jr | 2011-10-24 17:32:47 -0500 |
---|---|---|
committer | Franklin Cooper Jr | 2011-10-24 17:32:47 -0500 |
commit | e29ad5e40b37c5f0e9b5d340b48812390a6cc8c2 (patch) | |
tree | 6f7746778e2a3fc0c8c13f97db460e106b8c7dcc | |
parent | 2fb542ad03c647103fee844bb5088e658fc4015b (diff) | |
download | matrix-gui-v2-e29ad5e40b37c5f0e9b5d340b48812390a6cc8c2.tar.gz matrix-gui-v2-e29ad5e40b37c5f0e9b5d340b48812390a6cc8c2.tar.xz matrix-gui-v2-e29ad5e40b37c5f0e9b5d340b48812390a6cc8c2.zip |
Updated the generate script to be case insensitive when searching for .desktop parameters. Also added the deletetion of the temp file catdesktop.txt that is only used in the script.
-rw-r--r-- | generate.php | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/generate.php b/generate.php index 91f9fd6..70731a1 100644 --- a/generate.php +++ b/generate.php | |||
@@ -4,13 +4,15 @@ | |||
4 | function get_contents($category,$filestring) | 4 | function get_contents($category,$filestring) |
5 | { | 5 | { |
6 | 6 | ||
7 | $pos = strpos($filestring,$category."="); | 7 | $pos = stripos($filestring,$category."="); |
8 | 8 | ||
9 | 9 | ||
10 | if($pos != false) | 10 | if($pos != false) |
11 | { | 11 | { |
12 | $pos += strlen($category."="); | 12 | $pos += strlen($category."="); |
13 | $newlinepos = stripos($filestring,"\n",$pos); | 13 | $newlinepos = stripos($filestring,"\n",$pos); |
14 | if($newlinepos == -1) | ||
15 | $newlinepos = stripos($filestring,"\r",$pos); | ||
14 | $returnedstring = substr($filestring,$pos,$newlinepos-$pos); | 16 | $returnedstring = substr($filestring,$pos,$newlinepos-$pos); |
15 | return $returnedstring; | 17 | return $returnedstring; |
16 | } | 18 | } |
@@ -23,7 +25,7 @@ system("find -name '*.desktop' -print > catdesktop.txt"); | |||
23 | $handle = fopen("catdesktop.txt", "rb"); | 25 | $handle = fopen("catdesktop.txt", "rb"); |
24 | $contents = fread($handle,filesize("catdesktop.txt")); | 26 | $contents = fread($handle,filesize("catdesktop.txt")); |
25 | fclose($handle); | 27 | fclose($handle); |
26 | 28 | unlink('catdesktop.txt'); | |
27 | $contents = explode("\n",$contents); | 29 | $contents = explode("\n",$contents); |
28 | 30 | ||
29 | for($x = 0;$x<count($contents)&&strlen($contents[$x])>0;$x++) | 31 | for($x = 0;$x<count($contents)&&strlen($contents[$x])>0;$x++) |
@@ -89,9 +91,8 @@ for($x = 0;$x<count($contents)&&strlen($contents[$x])>0;$x++) | |||
89 | //-1 will be set if there is no link to the description page/no description field | 91 | //-1 will be set if there is no link to the description page/no description field |
90 | $top["Description_Link"] = $description_link; | 92 | $top["Description_Link"] = $description_link; |
91 | 93 | ||
92 | 94 | ||
93 | $top["Lock"] = get_contents("X-MATRIX-LOCK",$dotdesktop); | 95 | $top["Lock"] = get_contents("X-MATRIX-LOCK",$dotdesktop); |
94 | |||
95 | if($category == -1) | 96 | if($category == -1) |
96 | { | 97 | { |
97 | $application["top"]["apps"][] = $top; | 98 | $application["top"]["apps"][] = $top; |
@@ -135,5 +136,6 @@ $ourFileHandle = fopen($ourFileName, 'w') or die("can't open file"); | |||
135 | fwrite($ourFileHandle,json_encode($application)); | 136 | fwrite($ourFileHandle,json_encode($application)); |
136 | fclose($ourFileHandle); | 137 | fclose($ourFileHandle); |
137 | 138 | ||
139 | |||
138 | ?> | 140 | ?> |
139 | 141 | ||