winemaker: add workspace-parse function

André Hentschel nerv at dawncrow.de
Tue Mar 3 13:19:18 CST 2009


---
 tools/winemaker |   69 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 69 insertions(+), 0 deletions(-)

diff --git a/tools/winemaker b/tools/winemaker
index f82e95d..c47f928 100755
--- a/tools/winemaker
+++ b/tools/winemaker
@@ -1577,6 +1577,75 @@ sub source_scan_project_file($$$)
 }
 
 ##
+# Scans the specified workspace file to find the project files
+sub source_scan_workspace_file($);
+sub source_scan_workspace_file($)
+{
+    my $filename=$_[0];
+
+    if (! -e $filename) {
+        return;
+    }
+
+    if (!open(FILEIWS,$filename)) {
+        print STDERR "error: unable to open $filename for reading:\n";
+        print STDERR "       $!\n";
+        return;
+    }
+
+    my $prj_name;
+    my $prj_path;
+
+    if ($filename =~ /.dsw$/i) {
+        while (<FILEIWS>) {
+            # Remove any trailing CrLf
+            s/\r\n$/\n/;
+
+            # catch a project definition
+            if (/^Project:\s\"(.*)\"=(.*)\s-/) {
+                $prj_name=$1;
+                $prj_path=$2;
+                $prj_path=~s/\\\\/\\/g; #remove double backslash
+                $prj_path=~s/^\.\\//; #remove starting 'this directory'
+                $prj_path=~s/\\/\//g; #make slashes out of backslashes
+                print "Name: $prj_name\nPfad: $prj_path\n";
+                source_scan_project_file(\@main_project,1,$prj_path);
+                next;
+            } elsif (/^#/) {
+                # ignore Comments
+            } elsif (/\w:/) {
+                print STDERR "unknown section $_\n";
+            } elsif (/^Microsoft(.*)Studio(.*)File,\sFormat Version\s(.*)/) {
+                print "\nFileversion: $3\n";
+            }
+        }
+        close(FILEIWS);
+    } elsif ($filename =~ /.sln$/i) {
+        while (<FILEIWS>) {
+            # Remove any trailing CrLf
+            s/\r\n$/\n/;
+
+            # catch a project definition
+            if (/^Project(.*)=\s*"(.*)",\s*"(.*)",\s*"(.*)"/) {
+                $prj_name=$2;
+                $prj_path=$3;
+                $prj_path=~s/\\\\/\\/g; #remove double backslash
+                $prj_path=~s/^\.\\//; #remove starting 'this directory'
+                $prj_path=~s/\\/\//g; #make slashes out of backslashes
+                print "Name: $prj_name\nPfad: $prj_path\n";
+                source_scan_project_file(\@main_project,1,$prj_path);
+                next;
+            } elsif (/^Microsoft(.*)Studio(.*)File,\sFormat Version\s(.*)/) {
+                print "\nFileversion: $3\n";
+            }
+        }
+        close(FILEIWS);
+    }
+
+    @projects=sort { @$a[$P_PATH] cmp @$b[$P_PATH] } @projects;
+}
+
+##
 # Scan the source directories in search of things to build
 sub source_scan()
 {
-- 
1.6.0.4


--------------050508050900000808010004--



More information about the wine-patches mailing list