PackageManager: Options.xml
Added: trunk/rosapps/packmgr/cmd-line/options.xml
Added: trunk/rosapps/packmgr/gui/help.txt
Modified: trunk/rosapps/packmgr/gui/main.c
Added: trunk/rosapps/packmgr/gui/options.xml
Deleted: trunk/rosapps/packmgr/help.txt
Modified: trunk/rosapps/packmgr/lib/download.cpp
Modified: trunk/rosapps/packmgr/lib/functions.cpp
Modified: trunk/rosapps/packmgr/lib/main.cpp
Modified: trunk/rosapps/packmgr/lib/makefile
Modified: trunk/rosapps/packmgr/lib/package.cpp
Modified: trunk/rosapps/packmgr/lib/package.hpp
Modified: trunk/rosapps/packmgr/lib/tree.cpp
_____
Added: trunk/rosapps/packmgr/cmd-line/options.xml
--- trunk/rosapps/packmgr/cmd-line/options.xml 2005-04-20 18:16:32 UTC
(rev 14717)
+++ trunk/rosapps/packmgr/cmd-line/options.xml 2005-04-20 19:01:30 UTC
(rev 14718)
@@ -0,0 +1,4 @@
+<options>
+
<source>file://C:\Programmieren\reactos\rosapps\packmgr\tree\</source>
+
<source>http://svn.reactos.com/viewcvs/*checkout*/trunk/rosapps/packmgr/
tree/</source>
+</options>
\ No newline at end of file
_____
Added: trunk/rosapps/packmgr/gui/help.txt
--- trunk/rosapps/packmgr/gui/help.txt 2005-04-20 18:16:32 UTC (rev
14717)
+++ trunk/rosapps/packmgr/gui/help.txt 2005-04-20 19:01:30 UTC (rev
14718)
@@ -0,0 +1,8 @@
+Welcome to ReactOS's Package Manager !
+
+WARNING: This is still pre-alfa software you can't do much with it yet.
+
+This is the online help. You can show it at any time by clicking on the
the Questionmark Icon above.
+
+You can use this package manager like this: click on the
+You can also use the Buttons [ctrl] + [0] to [4] to set the action.
\ No newline at end of file
_____
Modified: trunk/rosapps/packmgr/gui/main.c
--- trunk/rosapps/packmgr/gui/main.c 2005-04-20 18:16:32 UTC (rev
14717)
+++ trunk/rosapps/packmgr/gui/main.c 2005-04-20 19:01:30 UTC (rev
14718)
@@ -121,8 +121,9 @@
for(i=0; i<2000; i++)
{
buffer[i] = getc(file);
- if(!buffer[i]) break;
+ if(buffer[i]==EOF) break;
}
+ buffer[i] = 0;
SetText(buffer);
}
@@ -245,9 +246,12 @@
{
buffer[j] = text[i];
if(buffer[j] == '\n')
- buffer[++j] = '\r';
+ {
+ buffer[j] = '\r';
+ buffer[++j] = '\n';
+ }
}
- buffer[i] = 0;
+ buffer[j] = 0;
SetWindowTextA(hEdit, buffer);
_____
Added: trunk/rosapps/packmgr/gui/options.xml
--- trunk/rosapps/packmgr/gui/options.xml 2005-04-20 18:16:32 UTC
(rev 14717)
+++ trunk/rosapps/packmgr/gui/options.xml 2005-04-20 19:01:30 UTC
(rev 14718)
@@ -0,0 +1,4 @@
+<options>
+
<source>file://C:\Programmieren\reactos\rosapps\packmgr\tree\</source>
+
<source>http://svn.reactos.com/viewcvs/*checkout*/trunk/rosapps/packmgr/
tree/</source>
+</options>
\ No newline at end of file
_____
Deleted: trunk/rosapps/packmgr/help.txt
--- trunk/rosapps/packmgr/help.txt 2005-04-20 18:16:32 UTC (rev
14717)
+++ trunk/rosapps/packmgr/help.txt 2005-04-20 19:01:30 UTC (rev
14718)
@@ -1,9 +0,0 @@
-Welcome to ReactOS's Package Manager !
-
-WARNING: This is still pre-alfa software you can't do much with it yet.
-
-This is the online help. You can show it at any time by clicking on the
the Questionmark Icon above.
-
-You can use this package manager like this: click on the
-You can also use the Buttons [ctrl] + [0] to [4] to set the action.
-
_____
Modified: trunk/rosapps/packmgr/lib/download.cpp
--- trunk/rosapps/packmgr/lib/download.cpp 2005-04-20 18:16:32 UTC
(rev 14717)
+++ trunk/rosapps/packmgr/lib/download.cpp 2005-04-20 19:01:30 UTC
(rev 14718)
@@ -15,9 +15,6 @@
#include "log.h"
#include <wine/urlmon.h>
-// Server there all the files lie
-const char* tree_server =
"http://svn.reactos.com/viewcvs/*checkout*/trunk/rosapps/packmgr/tree/";
-
HRESULT WINAPI URLDownloadToFileA(
LPUNKNOWN pCaller,
LPCSTR szURL,
@@ -29,12 +26,17 @@
int FindCount (string What, string Where, int start = 0, int end = -1);
-// Download a file
-char* PML_Download (const char* url, const char* server = "tree", const
char* filename = NULL)
+// Download a file
+char* PML_Download (pTree tree, const char* url, const char* server =
"tree", const char* filename = NULL)
{
- char downl [MAX_PATH];
- static char path [MAX_PATH];
+ UINT i;
+ static char downl [MAX_PATH]; // the full url
+ static char path [MAX_PATH]; // the full resulting Path
+ // It goes to the temp folder when no other path is entered (or
even compleatly no filename)
+ // If server == "tree" it will be downloaded from the server
speficied in option.xml
+ // File:// links are possible too
+
// get temp dir
if(!filename)
GetTempPathA (200, path);
@@ -52,18 +54,42 @@
GetTempFileNameA (path, "pml", 0, path);
// get the url
-
if (!server)
strcpy(downl, "");
else if(!strcmp(server, "tree"))
- strcpy(downl, tree_server);
+ {
+ char* ret;
+ for (i=0; i<tree->sources.size(); i++)
+ {
+ ret = PML_Download(tree, url, tree->sources[i],
filename);
+ if(ret)
+ return ret;
+ }
+ return NULL;
+ }
else
strcpy(downl, server);
strcat(downl, url);
+ // is this a file link ?
+ if (strstr(downl, "file://") || strstr(downl, "File://"))
+ {/*
+ if(downl[strlen(downl)] == '\')
+ downl[strlen(downl)] = '\0';
+ */
+ if(!filename)
+ return &downl[7];
+
+ else
+ {
+ CopyFileA(filename, &downl[7], FALSE);
+ return (char*)filename;
+ }
+ }
+
// download the file
if(URLDownloadToFileA (NULL, downl, path, 0, NULL) != S_OK)
{
@@ -77,19 +103,25 @@
}
// Download and prozess a xml file
-int PML_XmlDownload (const char* url, void* usrdata,
XML_StartElementHandler start,
- XML_EndElementHandler
end, XML_CharacterDataHandler text)
+int PML_XmlDownload (pTree tree, const char* url, void* usrdata,
+ XML_StartElementHandler
start, XML_EndElementHandler end, XML_CharacterDataHandler text)
{
+ int done = 0;
char buffer[255];
- int done = 0;
+ char* filename = 0;
// logging
Log("* prozess the xml file: ");
LogAdd(url);
// download the file
- char* filename = PML_Download(url);
+ if(strstr(url, "file://"))
+ filename = PML_Download(tree, url, NULL);
+ else
+ filename = PML_Download(tree, url);
+
+
if(!filename)
{
Log("! ERROR: Could not download the xml file");
@@ -100,7 +132,9 @@
FILE* file = fopen(filename, "r");
if(!file)
{
- Log("! ERROR: Could not open the xml file");
+ MessageBoxA(0,filename,0,0);
+ Log("! ERROR: Could not open the xml file \"");
+ LogAdd(filename);
return ERR_GENERIC;
}
_____
Modified: trunk/rosapps/packmgr/lib/functions.cpp
--- trunk/rosapps/packmgr/lib/functions.cpp 2005-04-20 18:16:32 UTC
(rev 14717)
+++ trunk/rosapps/packmgr/lib/functions.cpp 2005-04-20 19:01:30 UTC
(rev 14718)
@@ -15,7 +15,7 @@
#include "log.h"
extern const char* tree_server;
-char* PML_Download (const char* url, const char* server, const char*
filename);
+char* PML_Download (pTree, const char* url, const char* server, const
char* filename);
int debuglog (int argc, char* argv[])
@@ -31,10 +31,10 @@
char* result;
if (argc==3)
- result = PML_Download(argv[1], argv[3], argv[2]);
+ result = PML_Download(NULL, argv[1], argv[3], argv[2]);
else if (argc==2)
- result = PML_Download(argv[1], NULL, argv[2]);
+ result = PML_Download(NULL, argv[1], NULL, argv[2]);
else
return ERR_GENERIC;
_____
Modified: trunk/rosapps/packmgr/lib/main.cpp
--- trunk/rosapps/packmgr/lib/main.cpp 2005-04-20 18:16:32 UTC (rev
14717)
+++ trunk/rosapps/packmgr/lib/main.cpp 2005-04-20 19:01:30 UTC (rev
14718)
@@ -19,7 +19,7 @@
HANDLE hThread = NULL;
BOOL thread_abort = FALSE;
-char* PML_Download (const char* url, const char* server = "tree",
const char* filename = NULL);
+char* PML_Download (pTree, const char* url, const char* server =
"tree", const char* filename = NULL);
// Abort other thread
@@ -47,7 +47,7 @@
{
SCRIPT* script;
- char* path = PML_Download(tree->todo[i]);
+ char* path = PML_Download(tree, tree->todo[i]);
if(RPS_Load(&script, path) == ERR_OK)
scripts.push_back(script);
_____
Modified: trunk/rosapps/packmgr/lib/makefile
--- trunk/rosapps/packmgr/lib/makefile 2005-04-20 18:16:32 UTC (rev
14717)
+++ trunk/rosapps/packmgr/lib/makefile 2005-04-20 19:01:30 UTC (rev
14718)
@@ -6,7 +6,7 @@
TARGET_SDKLIBS = kernel32.a shell32.a user32.a package.a expat.a
urlmon.a
-TARGET_OBJECTS = main.o tree.o package.o download.o script.o
functions.o log.o
+TARGET_OBJECTS = main.o tree.o package.o download.o script.o
functions.o options.o log.o
TARGET_GCCLIBS = stdc++ uuid
_____
Modified: trunk/rosapps/packmgr/lib/package.cpp
--- trunk/rosapps/packmgr/lib/package.cpp 2005-04-20 18:16:32 UTC
(rev 14717)
+++ trunk/rosapps/packmgr/lib/package.cpp 2005-04-20 19:01:30 UTC
(rev 14718)
@@ -14,8 +14,8 @@
#include "expat.h"
#include "log.h"
-int PML_XmlDownload (const char* url, void* usrdata,
XML_StartElementHandler start,
- XML_EndElementHandler end,
XML_CharacterDataHandler text=0);
+int PML_XmlDownload (pTree, const char* url, void* usrdata,
XML_StartElementHandler start,
+
XML_EndElementHandler end, XML_CharacterDataHandler text=0);
// expat callback for start of a package tag
@@ -109,7 +109,7 @@
if(!pack->loaded)
{
- PML_XmlDownload (pack->path, (void*)pack, pack_start,
pack_end, pack_text);
+ PML_XmlDownload (tree, pack->path, (void*)pack,
pack_start, pack_end, pack_text);
pack->loaded = TRUE;
}
@@ -208,7 +208,7 @@
// load it if it's not loaded yet
else if (!pack->loaded && pack->path)
{
- PML_XmlDownload (pack->path, (void*)pack, pack_start,
pack_end, pack_text);
+ PML_XmlDownload (tree, pack->path, (void*)pack,
pack_start, pack_end, pack_text);
pack->loaded = TRUE;
return PML_SetAction(tree, id, action, SetIcon, Ask);
@@ -262,17 +262,17 @@
}
}
- // set action back
- pack->action = 0;
-
// root notes (like network) return here
if(!pack->path || pack->action==0)
return ret;
-
+
// erase from todo list
for(i=0; i<tree->todo.size(); i++)
if(!strcmp(tree->todo[i],
pack->files[pack->action-1])) // look for right entry
tree->todo.erase(tree->todo.begin()+i);
// delete it
+
+ // set action back
+ pack->action = 0;
}
return ret;
_____
Modified: trunk/rosapps/packmgr/lib/package.hpp
--- trunk/rosapps/packmgr/lib/package.hpp 2005-04-20 18:16:32 UTC
(rev 14717)
+++ trunk/rosapps/packmgr/lib/package.hpp 2005-04-20 19:01:30 UTC
(rev 14718)
@@ -26,15 +26,15 @@
typedef struct
{
char* path;
+ char* name;
+ char* description;
+ char** field;
+
BOOL icon;
BOOL loaded;
+ vector<int> neededBy;
vector<int> children;
-
- char** field;
- char* name;
- char* description;
vector<char*> depencies;
- vector<int> neededBy;
int action;
char* files [4];
@@ -49,10 +49,11 @@
typedef struct
{
- char* xmltree;
+ char** field;
+ vector<char*> todo;
+ vector<char*> sources;
vector<char*> descriptionPath;
- vector<char*> todo;
vector<PACKAGE> packages;
PML_AddItem addItem;
_____
Modified: trunk/rosapps/packmgr/lib/tree.cpp
--- trunk/rosapps/packmgr/lib/tree.cpp 2005-04-20 18:16:32 UTC (rev
14717)
+++ trunk/rosapps/packmgr/lib/tree.cpp 2005-04-20 19:01:30 UTC (rev
14718)
@@ -15,11 +15,13 @@
vector <int> parents;
+int LoadOptions (TREE* tree);
+
void tree_end (void* tree, const char* tag);
void tree_start (void* usrdata, const char* tag, const char** arg);
-int PML_XmlDownload (const char* file, void* usrdata,
XML_StartElementHandler start,
- XML_EndElementHandler end,
XML_CharacterDataHandler text=0);
+int PML_XmlDownload (pTree tree, const char* file, void* usrdata,
XML_StartElementHandler start,
+
XML_EndElementHandler end, XML_CharacterDataHandler text=0);
// Load the tree
@@ -34,7 +36,9 @@
// set addItem callback
(*tree)->addItem = AddItem;
- return PML_XmlDownload (url, (void*)(*tree), tree_start,
tree_end);
+ LoadOptions(*tree);
+
+ return PML_XmlDownload (*tree, url, (void*)(*tree), tree_start,
tree_end);
}
// expat callback for start of a "node" tag
@@ -119,3 +123,4 @@
// delete last item
parents.pop_back();
}
+