-P switch to set root path for files when creating cabinet
Modified: branches/xmlbuildsystem/reactos/tools/cabman/dfp.cxx
Modified: branches/xmlbuildsystem/reactos/tools/cabman/dfp.h
Modified: branches/xmlbuildsystem/reactos/tools/cabman/main.cxx

Modified: branches/xmlbuildsystem/reactos/tools/cabman/dfp.cxx
--- branches/xmlbuildsystem/reactos/tools/cabman/dfp.cxx	2005-03-13 20:55:16 UTC (rev 14029)
+++ branches/xmlbuildsystem/reactos/tools/cabman/dfp.cxx	2005-03-13 21:02:04 UTC (rev 14030)
@@ -78,6 +78,8 @@
 
     InfModeEnabled = false;
     InfFileHandle = NULL;
+    
+    strcpy(FileRelativePath, "");
 }
 
 CDFParser::~CDFParser()
@@ -385,6 +387,20 @@
 }
 
 
+void CDFParser::SetFileRelativePath(char* Path)
+/*
+ * FUNCTION: Sets path where files in the .dff is assumed relative to
+ * ARGUMENTS:
+ *    Path = Pointer to string with path
+ */
+{
+    strcpy(FileRelativePath, Path);
+    ConvertPath(FileRelativePath, false);
+    if (strlen(FileRelativePath) > 0)
+        NormalizePath(FileRelativePath, MAX_PATH);
+}
+
+
 bool CDFParser::OnDiskLabel(unsigned long Number, char* Label)
 /*
  * FUNCTION: Called when a disk needs a label
@@ -1001,7 +1017,7 @@
     char DstName[MAX_PATH];
     char InfLine[MAX_PATH];
 
-    strcpy(SrcName, "");
+    strcpy(SrcName, FileRelativePath);
     strcpy(DstName, "");
 
     i = CurrentChar;
@@ -1015,7 +1031,7 @@
     CurrentString[i] = '\0';
     CurrentToken = TokenString;
     CurrentChar  = i + 1;
-    strcpy(SrcName, CurrentString);
+    strcat(SrcName, CurrentString);
 
     SkipSpaces();
 

Modified: branches/xmlbuildsystem/reactos/tools/cabman/dfp.h
--- branches/xmlbuildsystem/reactos/tools/cabman/dfp.h	2005-03-13 20:55:16 UTC (rev 14029)
+++ branches/xmlbuildsystem/reactos/tools/cabman/dfp.h	2005-03-13 21:02:04 UTC (rev 14030)
@@ -60,8 +60,10 @@
     virtual ~CDFParser();
     unsigned long Load(char* FileName);
     unsigned long Parse();
-    bool InfFileOnly;
+    void SetFileRelativePath(char* Path);
+	bool InfFileOnly;
     bool DontGenerateInf;
+    char FileRelativePath[300];
 private:
     /* Event handlers */
     virtual bool OnDiskLabel(unsigned long Number, char* Label);

Modified: branches/xmlbuildsystem/reactos/tools/cabman/main.cxx
--- branches/xmlbuildsystem/reactos/tools/cabman/main.cxx	2005-03-13 20:55:16 UTC (rev 14029)
+++ branches/xmlbuildsystem/reactos/tools/cabman/main.cxx	2005-03-13 21:02:04 UTC (rev 14030)
@@ -190,7 +190,7 @@
 {
     printf("ReactOS Cabinet Manager - Version %s\n\n", CM_VERSION);
     printf("CABMAN [-D | -E] [-A] [-L dir] cabinet [filename ...]\n");
-    printf("CABMAN -C dirfile [-I] [-RC file]\n");
+    printf("CABMAN -C dirfile [-I] [-RC file] [-P dir]\n");
     printf("CABMAN -S cabinet filename\n");
     printf("  cabinet   Cabinet file.\n");
     printf("  filename  Name of the file to extract from the cabinet.\n");
@@ -211,6 +211,7 @@
     printf("  -RC       Specify file to put in cabinet reserved area\n");
     printf("            (size must be less than 64KB).\n");
     printf("  -S        Create simple cabinet.\n");
+    printf("  -P dir    Files in the .dff are relative to this directory\n");
 }
 
 bool CCABManager::ParseCmdline(int argc, char* argv[])
@@ -276,6 +277,14 @@
                     break;
           case 's':
           case 'S': Mode = CM_MODE_CREATE_SIMPLE; break;
+          case 'P':
+                    if (argv[i][2] == 0) {
+                        i++;
+                        SetFileRelativePath((char*)&argv[i][0]);
+                    } else {
+                        SetFileRelativePath((char*)&argv[i][1]);
+                    }
+                    break;
           default:
                     printf("Bad parameter %s.\n", argv[i]);
                     return false;