summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFranklin Cooper Jr2011-10-24 17:32:47 -0500
committerFranklin Cooper Jr2011-10-24 17:32:47 -0500
commite29ad5e40b37c5f0e9b5d340b48812390a6cc8c2 (patch)
tree6f7746778e2a3fc0c8c13f97db460e106b8c7dcc
parent2fb542ad03c647103fee844bb5088e658fc4015b (diff)
downloadmatrix-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.php10
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 @@
4function get_contents($category,$filestring) 4function 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"));
25fclose($handle); 27fclose($handle);
26 28unlink('catdesktop.txt');
27$contents = explode("\n",$contents); 29$contents = explode("\n",$contents);
28 30
29for($x = 0;$x<count($contents)&&strlen($contents[$x])>0;$x++) 31for($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");
135fwrite($ourFileHandle,json_encode($application)); 136fwrite($ourFileHandle,json_encode($application));
136fclose($ourFileHandle); 137fclose($ourFileHandle);
137 138
139
138?> 140?>
139 141