PackageManager: Bug fix
authorMaarten Bosma <maarten@bosma.de>
Mon, 11 Apr 2005 17:59:52 +0000 (17:59 +0000)
committerMaarten Bosma <maarten@bosma.de>
Mon, 11 Apr 2005 17:59:52 +0000 (17:59 +0000)
svn path=/trunk/; revision=14590

rosapps/packmgr/lib/download.cpp
rosapps/packmgr/lib/es.rc
rosapps/packmgr/lib/functions.cpp
rosapps/packmgr/lib/main.cpp
rosapps/packmgr/lib/package.cpp
rosapps/packmgr/tree/mozcontrol.xml

index 6528ae5..8d450f3 100644 (file)
@@ -26,35 +26,48 @@ HRESULT WINAPI URLDownloadToFileA(
     LPBINDSTATUSCALLBACK lpfnCB\r
 );\r
 \r
+int FindCount (string What, string Where, int start = 0, int end = -1);\r
+\r
 \r
 // Download a file\r
-char* PML_Download (const char* name, const char* local_name = "packmgr.txt", const char* server = tree_server, BOOL totemp = TRUE\r
+char* PML_Download (const char* url, const char* server = "tree", const char* filename = NULL\r
 {\r
-       char url [MAX_PATH];\r
-       static char path [MAX_PATH]; \r
+       char downl [MAX_PATH];\r
+       static char path [MAX_PATH];\r
 \r
        // get temp dir\r
-       if(totemp)\r
+       if(!filename)\r
+               GetTempPathA (200, path);\r
+\r
+       else if(!strstr(filename, "\\"))\r
                GetTempPathA (200, path);\r
        \r
        // create the local file name\r
-       if(local_name)\r
-               strcat(path, local_name);\r
+       if(filename)\r
+       {\r
+               strcat(path, filename);\r
+               DeleteFileA (path);\r
+       }\r
        else\r
-               strcat(path, "tmp.tmp"); \r
+               GetTempFileNameA (path, "pml", 0, path); \r
 \r
        // get the url\r
-       if(server) strcpy(url, server);\r
-       strcat(url, name);\r
        \r
-       // make sure there is no old file\r
-       DeleteFileA (path);     \r
+       if (!server);\r
+\r
+       else if(!strcmp(server, "tree")) \r
+               strcpy(downl, tree_server);\r
+\r
+       else \r
+               strcpy(downl, server);\r
+\r
+       strcat(downl, url);\r
 \r
        // download the file\r
-       if(URLDownloadToFileA (NULL, url, path, 0, NULL) != S_OK)\r
+       if(URLDownloadToFileA (NULL, downl, path, 0, NULL) != S_OK)\r
        {\r
                Log("!  ERROR: Unable to download ");\r
-               LogAdd(url);\r
+               LogAdd(downl);\r
 \r
                return NULL;\r
        }\r
index fa579f7..cdb0e0c 100644 (file)
@@ -14,6 +14,10 @@ BEGIN
   ERR_SYNATX       "Error durante la ejecución del Script.\nSintaxis errónea."\r
   ERR_CALL         "Error durante la ejecución del Script.\nNo se pudo encontrar la función."\r
   ERR_PARAMETER    "Error durante la ejecución del Script.\nParametro(s) erróneo."\r
+\r
+  ERR_DEP1        "To install this package you have to install the following package(s) as well:\n\n"\r
+  ERR_DEP2        "\nDo you want this ?"\r
+  ERR_READY       "You choosen to install %d package(s). To install them you have to read and agree with each of thier licences.\n\n Do you want still want to ?"\r
 END\r
 \r
 /* EOF */\r
index d7524d6..ff6f137 100644 (file)
@@ -1,6 +1,6 @@
 ////////////////////////////////////////////////////////\r
 //\r
-// script.cpp\r
+// functions.cpp\r
 // \r
 // Script Functions\r
 //\r
@@ -15,7 +15,7 @@
 #include "log.h"\r
 \r
 extern const char* tree_server;\r
-char* PML_Download (const char* name, const char* local_name, const char* server, BOOL totemp = TRUE);\r
+char* PML_Download (const char* url, const char* server,  const char* filename);\r
 \r
 \r
 int debuglog (int argc, char* argv[])\r
@@ -31,10 +31,10 @@ int download (int argc, char* argv[])
        char* result;\r
 \r
        if (argc==3)\r
-               result = PML_Download(argv[1], argv[2], argv[3]);\r
+               result = PML_Download(argv[1], argv[3], argv[2]);\r
 \r
        else if (argc==2)\r
-               result = PML_Download(argv[1], argv[2], NULL);\r
+               result = PML_Download(argv[1], NULL, argv[2]);\r
 \r
        else \r
                return ERR_GENERIC;\r
index db126ca..6463e05 100644 (file)
@@ -19,8 +19,7 @@
 HANDLE hThread = NULL;\r
 BOOL thread_abort = FALSE;\r
 \r
-extern const char* tree_server;\r
-char* PML_Download (const char* name, const char* local_name = "packmgr.txt", const char* server = tree_server, BOOL totemp = TRUE);\r
+char* PML_Download (const char* url, const char* server = "tree",  const char* filename = NULL);\r
 \r
 \r
 // Abort other thread\r
index 7610d00..883be31 100644 (file)
@@ -169,7 +169,7 @@ extern "C" int PML_SetAction (TREE* tree, int id, int action, PML_SetIcon SetIco
                UINT count = pack->depencies.size();\r
                WCHAR buffer[2000], buffer2[200];\r
                wcscpy(buffer, PML_TransError(ERR_DEP1));\r
-               \r
+\r
                for (i=0; i<pack->depencies.size(); i++)\r
                {\r
                        int item = PML_FindItem(tree, pack->depencies[i]);\r
@@ -190,16 +190,18 @@ extern "C" int PML_SetAction (TREE* tree, int id, int action, PML_SetIcon SetIco
                wcscat(buffer, PML_TransError(ERR_DEP2));\r
 \r
                if(count)\r
+               {\r
                        if(!Ask(buffer))\r
                                return ERR_GENERIC;\r
 \r
-               for (i=0; i<pack->depencies.size(); i++)\r
-               {\r
-                       int item = PML_FindItem(tree, pack->depencies[i]);\r
+                       for (i=0; i<pack->depencies.size(); i++)\r
+                       {\r
+                               int item = PML_FindItem(tree, pack->depencies[i]);\r
 \r
-                       tree->packages[item].neededBy.push_back(id);\r
+                               tree->packages[item].neededBy.push_back(id);\r
 \r
-                       PML_SetAction(tree, item, action, SetIcon, Ask);\r
+                               PML_SetAction(tree, item, action, SetIcon, Ask);\r
+                       }\r
                }\r
        }\r
 \r
index db04a04..b26a6e2 100644 (file)
@@ -2,6 +2,5 @@
   <name>MozillaControl</name>\r
   <description>Provide the Gekko Engine for ReactOS.</description>\r
   <scripts inst="mozillacontrol.inst.rps" srcinst="mozillacontrol.inst.rps"/>\r
-  <depent>abiword</depent>\r
 </package>\r
 \r