Gitweb links:

...log 
http://git.netsurf-browser.org/netsurf.git/shortlog/4c68def4321911e417a98deb1d394fb96e42100f
...commit 
http://git.netsurf-browser.org/netsurf.git/commit/4c68def4321911e417a98deb1d394fb96e42100f
...tree 
http://git.netsurf-browser.org/netsurf.git/tree/4c68def4321911e417a98deb1d394fb96e42100f

The branch, master has been updated
       via  4c68def4321911e417a98deb1d394fb96e42100f (commit)
       via  77d184913b64b1613ac70acb23c1230c5ec41e67 (commit)
       via  56ddeed96c10bae6e67b7e15ee6fa982a0f40b3f (commit)
       via  2f7de349ea4b9f26bf14d0ee5704cfe248462dd7 (commit)
      from  faf667ada7181b50890bc9fc970b99da0916d02c (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commitdiff 
http://git.netsurf-browser.org/netsurf.git/commit/?id=4c68def4321911e417a98deb1d394fb96e42100f
commit 4c68def4321911e417a98deb1d394fb96e42100f
Author: Vincent Sanders <[email protected]>
Commit: Vincent Sanders <[email protected]>

    extend search for certificate file to include resource paths

diff --git a/frontends/windows/main.c b/frontends/windows/main.c
index 2dd403e..eb0a866 100644
--- a/frontends/windows/main.c
+++ b/frontends/windows/main.c
@@ -190,6 +190,11 @@ static nserror set_defaults(struct nsoption_s *defaults)
                              &ptr);
        if (res_len > 0) {
                nsoption_setnull_charp(ca_bundle, strdup(buf));
+       } else {
+               ptr = filepath_sfind(G_resource_pathv, buf, "ca-bundle.crt");
+               if (ptr != NULL) {
+                       nsoption_setnull_charp(ca_bundle, strdup(buf));
+               }
        }
 
 


commitdiff 
http://git.netsurf-browser.org/netsurf.git/commit/?id=77d184913b64b1613ac70acb23c1230c5ec41e67
commit 77d184913b64b1613ac70acb23c1230c5ec41e67
Author: Vincent Sanders <[email protected]>
Commit: Vincent Sanders <[email protected]>

    rename global resource path variables in win32 frontend

diff --git a/frontends/windows/fetch.c b/frontends/windows/fetch.c
index f69d7ad..287f20f 100644
--- a/frontends/windows/fetch.c
+++ b/frontends/windows/fetch.c
@@ -79,7 +79,7 @@ static nsurl *nsw32_get_resource_url(const char *path)
        char buf[PATH_MAX];
        nsurl *url = NULL;
 
-       netsurf_path_to_nsurl(filepath_sfind(respaths, buf, path), &url);
+       netsurf_path_to_nsurl(filepath_sfind(G_resource_pathv, buf, path), 
&url);
 
        return url;
 }
diff --git a/frontends/windows/gui.c b/frontends/windows/gui.c
index 490f234..fdfafcf 100644
--- a/frontends/windows/gui.c
+++ b/frontends/windows/gui.c
@@ -41,13 +41,15 @@
 #include "windows/window.h"
 #include "windows/gui.h"
 
-/**
- * win32 application instance handle.
- *
- * This handle is set in the main windows entry point.
- */
+/* exported global defined in windows/gui.h */
 HINSTANCE hinst;
 
+/* exported global defined in windows/gui.h */
+char **G_resource_pathv;
+
+/* exported global defined in windows/gui.h */
+char *G_config_path;
+
 static bool win32_quit = false;
 
 struct dialog_list_entry {
diff --git a/frontends/windows/gui.h b/frontends/windows/gui.h
index 8f8f0bc..0633c93 100644
--- a/frontends/windows/gui.h
+++ b/frontends/windows/gui.h
@@ -22,13 +22,22 @@
 
 struct gui_window;
 
+/**
+ * win32 application instance handle.
+ *
+ * This handle is set in the main windows entry point.
+ */
 extern HINSTANCE hinst;
 
-/** Directory where all configuration files are held. */
-extern char *nsw32_config_home;
+/**
+ * path to where all user config files are held.
+ */
+extern char *G_config_path;
 
-/** resource search path vector. */
-extern char **respaths;
+/**
+ * resource search path vector.
+ */
+extern char **G_resource_pathv;
 
 /* bounding box */
 typedef struct bbox_s {
diff --git a/frontends/windows/main.c b/frontends/windows/main.c
index cf94712..2dd403e 100644
--- a/frontends/windows/main.c
+++ b/frontends/windows/main.c
@@ -57,9 +57,6 @@
 #include "windows/clipboard.h"
 #include "windows/gui.h"
 
-char **respaths; /** exported global defined in windows/gui.h */
-
-char *nsw32_config_home; /* exported global defined in windows/gui.h */
 
 /**
  * Obtain the DPI of the display.
@@ -224,28 +221,28 @@ static nserror set_defaults(struct nsoption_s *defaults)
 
        /* cookie file default */
        fname = NULL;
-       netsurf_mkpath(&fname, NULL, 2, nsw32_config_home, "Cookies");
+       netsurf_mkpath(&fname, NULL, 2, G_config_path, "Cookies");
        if (fname != NULL) {
                nsoption_setnull_charp(cookie_file, fname);
        }
 
        /* cookie jar default */
        fname = NULL;
-       netsurf_mkpath(&fname, NULL, 2, nsw32_config_home, "Cookies");
+       netsurf_mkpath(&fname, NULL, 2, G_config_path, "Cookies");
        if (fname != NULL) {
                nsoption_setnull_charp(cookie_jar, fname);
        }
 
        /* url database default */
        fname = NULL;
-       netsurf_mkpath(&fname, NULL, 2, nsw32_config_home, "URLs");
+       netsurf_mkpath(&fname, NULL, 2, G_config_path, "URLs");
        if (fname != NULL) {
                nsoption_setnull_charp(url_file, fname);
        }
 
        /* bookmark database default */
        fname = NULL;
-       netsurf_mkpath(&fname, NULL, 2, nsw32_config_home, "Hotlist");
+       netsurf_mkpath(&fname, NULL, 2, G_config_path, "Hotlist");
        if (fname != NULL) {
                nsoption_setnull_charp(hotlist_path, fname);
        }
@@ -257,11 +254,16 @@ static nserror set_defaults(struct nsoption_s *defaults)
 /**
  * Initialise user options location and contents
  */
-static nserror nsw32_option_init(int *pargc, char** argv)
+static nserror
+nsw32_option_init(int *pargc, char** argv, char **respaths, char *config_path)
 {
        nserror ret;
        char *choices = NULL;
 
+       /* set the globals that will be used in the set_defaults() callback */
+       G_resource_pathv = respaths;
+       G_config_path = config_path;
+
        /* user options setup */
        ret = nsoption_init(set_defaults, &nsoptions, &nsoptions_default);
        if (ret != NSERROR_OK) {
@@ -269,7 +271,7 @@ static nserror nsw32_option_init(int *pargc, char** argv)
        }
 
        /* Attempt to load the user choices */
-       ret = netsurf_mkpath(&choices, NULL, 2, nsw32_config_home, "Choices");
+       ret = netsurf_mkpath(&choices, NULL, 2, config_path, "Choices");
        if (ret == NSERROR_OK) {
                nsoption_read(choices, nsoptions);
                free(choices);
@@ -311,6 +313,10 @@ static nserror nsw32_messages_init(char **respaths)
 
 /**
  * Construct a unix style argc/argv
+ *
+ * \param argc_out number of commandline arguments
+ * \param argv_out string vector of command line arguments
+ * \return NSERROR_OK on success else error code
  */
 static nserror win32_to_unix_commandline(int *argc_out, char ***argv_out)
 {
@@ -318,6 +324,7 @@ static nserror win32_to_unix_commandline(int *argc_out, 
char ***argv_out)
        char **argv;
        int cura;
        LPWSTR *argvw;
+       size_t len;
 
        argvw = CommandLineToArgvW(GetCommandLineW(), &argc);
        if (argvw == NULL) {
@@ -367,9 +374,10 @@ static struct gui_misc_table win32_misc_table = {
 int WINAPI
 WinMain(HINSTANCE hInstance, HINSTANCE hLastInstance, LPSTR lpcli, int ncmd)
 {
-       char **argv = NULL;
-       int argc = 0;
-       size_t len;
+       int argc;
+       char **argv;
+       char **respaths;
+       char *nsw32_config_home = NULL;
        nserror ret;
        const char *addr;
        nsurl *url;
@@ -414,13 +422,12 @@ WinMain(HINSTANCE hInstance, HINSTANCE hLastInstance, 
LPSTR lpcli, int ncmd)
        if (ret != NSERROR_OK) {
                NSLOG(netsurf, INFO,
                      "Unable to locate a configuration directory.");
-               nsw32_config_home = NULL;
        }
 
        /* Initialise user options */
-       ret = nsw32_option_init(&argc, argv);
+       ret = nsw32_option_init(&argc, argv, respaths, nsw32_config_home);
        if (ret != NSERROR_OK) {
-               NSLOG(netsurf, INFO, "Options failed to initialise (%s)\n",
+               NSLOG(netsurf, ERROR, "Options failed to initialise (%s)\n",
                      messages_get_errorcode(ret));
                return 1;
        }
diff --git a/frontends/windows/prefs.c b/frontends/windows/prefs.c
index b2cb7b2..9937f2e 100644
--- a/frontends/windows/prefs.c
+++ b/frontends/windows/prefs.c
@@ -699,7 +699,7 @@ nserror nsws_prefs_save(void)
        char *choices = NULL;
        nserror res;
 
-       res = netsurf_mkpath(&choices, NULL, 2, nsw32_config_home, "Choices");
+       res = netsurf_mkpath(&choices, NULL, 2, G_config_path, "Choices");
        if (res == NSERROR_OK) {
                nsoption_write(choices, NULL, NULL);
                free(choices);


commitdiff 
http://git.netsurf-browser.org/netsurf.git/commit/?id=56ddeed96c10bae6e67b7e15ee6fa982a0f40b3f
commit 56ddeed96c10bae6e67b7e15ee6fa982a0f40b3f
Author: Vincent Sanders <[email protected]>
Commit: Vincent Sanders <[email protected]>

    separate out construction of command line argument string vector

diff --git a/frontends/windows/main.c b/frontends/windows/main.c
index d71bb87..cf94712 100644
--- a/frontends/windows/main.c
+++ b/frontends/windows/main.c
@@ -308,6 +308,55 @@ static nserror nsw32_messages_init(char **respaths)
        return res;
 }
 
+
+/**
+ * Construct a unix style argc/argv
+ */
+static nserror win32_to_unix_commandline(int *argc_out, char ***argv_out)
+{
+       int argc = 0;
+       char **argv;
+       int cura;
+       LPWSTR *argvw;
+
+       argvw = CommandLineToArgvW(GetCommandLineW(), &argc);
+       if (argvw == NULL) {
+               return NSERROR_INVALID;
+       }
+
+       argv = malloc(sizeof(char *) * argc);
+       if (argv == NULL) {
+               return NSERROR_NOMEM;
+       }
+
+       for (cura = 0; cura < argc; cura++) {
+
+               len = wcstombs(NULL, argvw[cura], 0) + 1;
+               if (len > 0) {
+                       argv[cura] = malloc(len);
+                       if (argv[cura] == NULL) {
+                               free(argv);
+                               return NSERROR_NOMEM;
+                       }
+               } else {
+                       free(argv);
+                       return NSERROR_INVALID;
+               }
+
+               wcstombs(argv[cura], argvw[cura], len);
+               /* alter windows-style forward slash flags to hyphen flags. */
+               if (argv[cura][0] == '/') {
+                       argv[cura][0] = '-';
+               }
+       }
+
+       *argc_out = argc;
+       *argv_out = argv;
+
+       return NSERROR_OK;
+}
+
+
 static struct gui_misc_table win32_misc_table = {
        .schedule = win32_schedule,
 };
@@ -319,9 +368,8 @@ int WINAPI
 WinMain(HINSTANCE hInstance, HINSTANCE hLastInstance, LPSTR lpcli, int ncmd)
 {
        char **argv = NULL;
-       int argc = 0, argctemp = 0;
+       int argc = 0;
        size_t len;
-       LPWSTR *argvw;
        nserror ret;
        const char *addr;
        nsurl *url;
@@ -347,27 +395,10 @@ WinMain(HINSTANCE hInstance, HINSTANCE hLastInstance, 
LPSTR lpcli, int ncmd)
 
        setbuf(stderr, NULL);
 
-       /* Construct a unix style argc/argv */
-       if (SLEN(lpcli) > 0) {
-               argvw = CommandLineToArgvW(GetCommandLineW(), &argc);
-       }
-
-       argv = malloc(sizeof(char *) * argc);
-       while (argctemp < argc) {
-               len = wcstombs(NULL, argvw[argctemp], 0) + 1;
-               if (len > 0) {
-                       argv[argctemp] = malloc(len);
-               }
-
-               if (argv[argctemp] != NULL) {
-                       wcstombs(argv[argctemp], argvw[argctemp], len);
-                       /* alter windows-style forward slash flags to
-                        * hyphen flags.
-                        */
-                       if (argv[argctemp][0] == '/')
-                               argv[argctemp][0] = '-';
-               }
-               argctemp++;
+       ret = win32_to_unix_commandline(&argc, &argv);
+       if (ret != NSERROR_OK) {
+               /* no log as logging requires this for initialisation */
+               return 1;
        }
 
        /* initialise logging - not fatal if it fails but not much we


commitdiff 
http://git.netsurf-browser.org/netsurf.git/commit/?id=2f7de349ea4b9f26bf14d0ee5704cfe248462dd7
commit 2f7de349ea4b9f26bf14d0ee5704cfe248462dd7
Author: Vincent Sanders <[email protected]>
Commit: Vincent Sanders <[email protected]>

    update resource search path to remove users directory
    
    it is no longer suitable to search the users home directory for
     general browser resources as the correct config path is now
    derived from the apropriate windows methods.
    
    Additionaly the NETSURFRES environment variable is no longer part
     of the fixed path and is instead added from the makefile
     configuration option.

diff --git a/frontends/windows/Makefile.defaults 
b/frontends/windows/Makefile.defaults
index 1d844f1..51e71ac 100644
--- a/frontends/windows/Makefile.defaults
+++ b/frontends/windows/Makefile.defaults
@@ -3,8 +3,8 @@
 # ----------------------------------------------------------------------------
 
 # Where to search for NetSurf's resources after looking in ~/.netsurf and
-# $NETSURFRES.  It must have a trailing backslash
-NETSURF_WINDOWS_RESPATH :=
+# ${APPDATA}\NetSurf.  It must have a trailing backslash
+NETSURF_WINDOWS_RESPATH := $${NETSURFRES}
 
 # Enable NetSurf's use of librosprite for displaying RISC OS Sprites
 # Valid options: YES, NO, AUTO
diff --git a/frontends/windows/main.c b/frontends/windows/main.c
index 54e0249..d71bb87 100644
--- a/frontends/windows/main.c
+++ b/frontends/windows/main.c
@@ -375,6 +375,9 @@ WinMain(HINSTANCE hInstance, HINSTANCE hLastInstance, LPSTR 
lpcli, int ncmd)
         */
        nslog_init(nslog_ensure, &argc, argv);
 
+       /* build resource path string vector */
+       respaths = 
nsws_init_resource("${APPDATA}\\NetSurf:${PROGRAMFILES}\\NetSurf\\NetSurf\\:"NETSURF_WINDOWS_RESPATH);
+
        /* Locate the correct user configuration directory path */
        ret = get_config_home(&nsw32_config_home);
        if (ret != NSERROR_OK) {
@@ -391,8 +394,6 @@ WinMain(HINSTANCE hInstance, HINSTANCE hLastInstance, LPSTR 
lpcli, int ncmd)
                return 1;
        }
 
-       respaths = 
nsws_init_resource("${APPDATA}\\NetSurf:${HOME}\\.netsurf:${NETSURFRES}:${PROGRAMFILES}\\NetSurf\\NetSurf\\:"NETSURF_WINDOWS_RESPATH);
-
        /* Initialise translated messages */
        ret = nsw32_messages_init(respaths);
        if (ret != NSERROR_OK) {


-----------------------------------------------------------------------

Summary of changes:
 frontends/windows/Makefile.defaults |    4 +-
 frontends/windows/fetch.c           |    2 +-
 frontends/windows/gui.c             |   12 ++--
 frontends/windows/gui.h             |   17 +++--
 frontends/windows/main.c            |  122 ++++++++++++++++++++++++-----------
 frontends/windows/prefs.c           |    2 +-
 6 files changed, 107 insertions(+), 52 deletions(-)

diff --git a/frontends/windows/Makefile.defaults 
b/frontends/windows/Makefile.defaults
index 1d844f1..51e71ac 100644
--- a/frontends/windows/Makefile.defaults
+++ b/frontends/windows/Makefile.defaults
@@ -3,8 +3,8 @@
 # ----------------------------------------------------------------------------
 
 # Where to search for NetSurf's resources after looking in ~/.netsurf and
-# $NETSURFRES.  It must have a trailing backslash
-NETSURF_WINDOWS_RESPATH :=
+# ${APPDATA}\NetSurf.  It must have a trailing backslash
+NETSURF_WINDOWS_RESPATH := $${NETSURFRES}
 
 # Enable NetSurf's use of librosprite for displaying RISC OS Sprites
 # Valid options: YES, NO, AUTO
diff --git a/frontends/windows/fetch.c b/frontends/windows/fetch.c
index f69d7ad..287f20f 100644
--- a/frontends/windows/fetch.c
+++ b/frontends/windows/fetch.c
@@ -79,7 +79,7 @@ static nsurl *nsw32_get_resource_url(const char *path)
        char buf[PATH_MAX];
        nsurl *url = NULL;
 
-       netsurf_path_to_nsurl(filepath_sfind(respaths, buf, path), &url);
+       netsurf_path_to_nsurl(filepath_sfind(G_resource_pathv, buf, path), 
&url);
 
        return url;
 }
diff --git a/frontends/windows/gui.c b/frontends/windows/gui.c
index 490f234..fdfafcf 100644
--- a/frontends/windows/gui.c
+++ b/frontends/windows/gui.c
@@ -41,13 +41,15 @@
 #include "windows/window.h"
 #include "windows/gui.h"
 
-/**
- * win32 application instance handle.
- *
- * This handle is set in the main windows entry point.
- */
+/* exported global defined in windows/gui.h */
 HINSTANCE hinst;
 
+/* exported global defined in windows/gui.h */
+char **G_resource_pathv;
+
+/* exported global defined in windows/gui.h */
+char *G_config_path;
+
 static bool win32_quit = false;
 
 struct dialog_list_entry {
diff --git a/frontends/windows/gui.h b/frontends/windows/gui.h
index 8f8f0bc..0633c93 100644
--- a/frontends/windows/gui.h
+++ b/frontends/windows/gui.h
@@ -22,13 +22,22 @@
 
 struct gui_window;
 
+/**
+ * win32 application instance handle.
+ *
+ * This handle is set in the main windows entry point.
+ */
 extern HINSTANCE hinst;
 
-/** Directory where all configuration files are held. */
-extern char *nsw32_config_home;
+/**
+ * path to where all user config files are held.
+ */
+extern char *G_config_path;
 
-/** resource search path vector. */
-extern char **respaths;
+/**
+ * resource search path vector.
+ */
+extern char **G_resource_pathv;
 
 /* bounding box */
 typedef struct bbox_s {
diff --git a/frontends/windows/main.c b/frontends/windows/main.c
index 54e0249..eb0a866 100644
--- a/frontends/windows/main.c
+++ b/frontends/windows/main.c
@@ -57,9 +57,6 @@
 #include "windows/clipboard.h"
 #include "windows/gui.h"
 
-char **respaths; /** exported global defined in windows/gui.h */
-
-char *nsw32_config_home; /* exported global defined in windows/gui.h */
 
 /**
  * Obtain the DPI of the display.
@@ -193,6 +190,11 @@ static nserror set_defaults(struct nsoption_s *defaults)
                              &ptr);
        if (res_len > 0) {
                nsoption_setnull_charp(ca_bundle, strdup(buf));
+       } else {
+               ptr = filepath_sfind(G_resource_pathv, buf, "ca-bundle.crt");
+               if (ptr != NULL) {
+                       nsoption_setnull_charp(ca_bundle, strdup(buf));
+               }
        }
 
 
@@ -224,28 +226,28 @@ static nserror set_defaults(struct nsoption_s *defaults)
 
        /* cookie file default */
        fname = NULL;
-       netsurf_mkpath(&fname, NULL, 2, nsw32_config_home, "Cookies");
+       netsurf_mkpath(&fname, NULL, 2, G_config_path, "Cookies");
        if (fname != NULL) {
                nsoption_setnull_charp(cookie_file, fname);
        }
 
        /* cookie jar default */
        fname = NULL;
-       netsurf_mkpath(&fname, NULL, 2, nsw32_config_home, "Cookies");
+       netsurf_mkpath(&fname, NULL, 2, G_config_path, "Cookies");
        if (fname != NULL) {
                nsoption_setnull_charp(cookie_jar, fname);
        }
 
        /* url database default */
        fname = NULL;
-       netsurf_mkpath(&fname, NULL, 2, nsw32_config_home, "URLs");
+       netsurf_mkpath(&fname, NULL, 2, G_config_path, "URLs");
        if (fname != NULL) {
                nsoption_setnull_charp(url_file, fname);
        }
 
        /* bookmark database default */
        fname = NULL;
-       netsurf_mkpath(&fname, NULL, 2, nsw32_config_home, "Hotlist");
+       netsurf_mkpath(&fname, NULL, 2, G_config_path, "Hotlist");
        if (fname != NULL) {
                nsoption_setnull_charp(hotlist_path, fname);
        }
@@ -257,11 +259,16 @@ static nserror set_defaults(struct nsoption_s *defaults)
 /**
  * Initialise user options location and contents
  */
-static nserror nsw32_option_init(int *pargc, char** argv)
+static nserror
+nsw32_option_init(int *pargc, char** argv, char **respaths, char *config_path)
 {
        nserror ret;
        char *choices = NULL;
 
+       /* set the globals that will be used in the set_defaults() callback */
+       G_resource_pathv = respaths;
+       G_config_path = config_path;
+
        /* user options setup */
        ret = nsoption_init(set_defaults, &nsoptions, &nsoptions_default);
        if (ret != NSERROR_OK) {
@@ -269,7 +276,7 @@ static nserror nsw32_option_init(int *pargc, char** argv)
        }
 
        /* Attempt to load the user choices */
-       ret = netsurf_mkpath(&choices, NULL, 2, nsw32_config_home, "Choices");
+       ret = netsurf_mkpath(&choices, NULL, 2, config_path, "Choices");
        if (ret == NSERROR_OK) {
                nsoption_read(choices, nsoptions);
                free(choices);
@@ -308,6 +315,60 @@ static nserror nsw32_messages_init(char **respaths)
        return res;
 }
 
+
+/**
+ * Construct a unix style argc/argv
+ *
+ * \param argc_out number of commandline arguments
+ * \param argv_out string vector of command line arguments
+ * \return NSERROR_OK on success else error code
+ */
+static nserror win32_to_unix_commandline(int *argc_out, char ***argv_out)
+{
+       int argc = 0;
+       char **argv;
+       int cura;
+       LPWSTR *argvw;
+       size_t len;
+
+       argvw = CommandLineToArgvW(GetCommandLineW(), &argc);
+       if (argvw == NULL) {
+               return NSERROR_INVALID;
+       }
+
+       argv = malloc(sizeof(char *) * argc);
+       if (argv == NULL) {
+               return NSERROR_NOMEM;
+       }
+
+       for (cura = 0; cura < argc; cura++) {
+
+               len = wcstombs(NULL, argvw[cura], 0) + 1;
+               if (len > 0) {
+                       argv[cura] = malloc(len);
+                       if (argv[cura] == NULL) {
+                               free(argv);
+                               return NSERROR_NOMEM;
+                       }
+               } else {
+                       free(argv);
+                       return NSERROR_INVALID;
+               }
+
+               wcstombs(argv[cura], argvw[cura], len);
+               /* alter windows-style forward slash flags to hyphen flags. */
+               if (argv[cura][0] == '/') {
+                       argv[cura][0] = '-';
+               }
+       }
+
+       *argc_out = argc;
+       *argv_out = argv;
+
+       return NSERROR_OK;
+}
+
+
 static struct gui_misc_table win32_misc_table = {
        .schedule = win32_schedule,
 };
@@ -318,10 +379,10 @@ static struct gui_misc_table win32_misc_table = {
 int WINAPI
 WinMain(HINSTANCE hInstance, HINSTANCE hLastInstance, LPSTR lpcli, int ncmd)
 {
-       char **argv = NULL;
-       int argc = 0, argctemp = 0;
-       size_t len;
-       LPWSTR *argvw;
+       int argc;
+       char **argv;
+       char **respaths;
+       char *nsw32_config_home = NULL;
        nserror ret;
        const char *addr;
        nsurl *url;
@@ -347,27 +408,10 @@ WinMain(HINSTANCE hInstance, HINSTANCE hLastInstance, 
LPSTR lpcli, int ncmd)
 
        setbuf(stderr, NULL);
 
-       /* Construct a unix style argc/argv */
-       if (SLEN(lpcli) > 0) {
-               argvw = CommandLineToArgvW(GetCommandLineW(), &argc);
-       }
-
-       argv = malloc(sizeof(char *) * argc);
-       while (argctemp < argc) {
-               len = wcstombs(NULL, argvw[argctemp], 0) + 1;
-               if (len > 0) {
-                       argv[argctemp] = malloc(len);
-               }
-
-               if (argv[argctemp] != NULL) {
-                       wcstombs(argv[argctemp], argvw[argctemp], len);
-                       /* alter windows-style forward slash flags to
-                        * hyphen flags.
-                        */
-                       if (argv[argctemp][0] == '/')
-                               argv[argctemp][0] = '-';
-               }
-               argctemp++;
+       ret = win32_to_unix_commandline(&argc, &argv);
+       if (ret != NSERROR_OK) {
+               /* no log as logging requires this for initialisation */
+               return 1;
        }
 
        /* initialise logging - not fatal if it fails but not much we
@@ -375,24 +419,24 @@ WinMain(HINSTANCE hInstance, HINSTANCE hLastInstance, 
LPSTR lpcli, int ncmd)
         */
        nslog_init(nslog_ensure, &argc, argv);
 
+       /* build resource path string vector */
+       respaths = 
nsws_init_resource("${APPDATA}\\NetSurf:${PROGRAMFILES}\\NetSurf\\NetSurf\\:"NETSURF_WINDOWS_RESPATH);
+
        /* Locate the correct user configuration directory path */
        ret = get_config_home(&nsw32_config_home);
        if (ret != NSERROR_OK) {
                NSLOG(netsurf, INFO,
                      "Unable to locate a configuration directory.");
-               nsw32_config_home = NULL;
        }
 
        /* Initialise user options */
-       ret = nsw32_option_init(&argc, argv);
+       ret = nsw32_option_init(&argc, argv, respaths, nsw32_config_home);
        if (ret != NSERROR_OK) {
-               NSLOG(netsurf, INFO, "Options failed to initialise (%s)\n",
+               NSLOG(netsurf, ERROR, "Options failed to initialise (%s)\n",
                      messages_get_errorcode(ret));
                return 1;
        }
 
-       respaths = 
nsws_init_resource("${APPDATA}\\NetSurf:${HOME}\\.netsurf:${NETSURFRES}:${PROGRAMFILES}\\NetSurf\\NetSurf\\:"NETSURF_WINDOWS_RESPATH);
-
        /* Initialise translated messages */
        ret = nsw32_messages_init(respaths);
        if (ret != NSERROR_OK) {
diff --git a/frontends/windows/prefs.c b/frontends/windows/prefs.c
index b2cb7b2..9937f2e 100644
--- a/frontends/windows/prefs.c
+++ b/frontends/windows/prefs.c
@@ -699,7 +699,7 @@ nserror nsws_prefs_save(void)
        char *choices = NULL;
        nserror res;
 
-       res = netsurf_mkpath(&choices, NULL, 2, nsw32_config_home, "Choices");
+       res = netsurf_mkpath(&choices, NULL, 2, G_config_path, "Choices");
        if (res == NSERROR_OK) {
                nsoption_write(choices, NULL, NULL);
                free(choices);


-- 
NetSurf Browser

_______________________________________________
netsurf-commits mailing list
[email protected]
http://listmaster.pepperfish.net/cgi-bin/mailman/listinfo/netsurf-commits-netsurf-browser.org

Reply via email to