Re: [PATCH setup] Add setup-minimum-version: to setup.ini
cyg Simple writes: > That point was already addressed by Jon and my retort was that the issue > could be resolved by supplying a symlink for the name without the version. You still failed to provide an evidence of the benefits outweighing the drawbacks. Also, I'm neither buying your argument that the practise you advocate is widespread (simply because there aren't many programs that work like setup.exe) nor that it is clearly better than the alternatives. Regards, Achim. -- +<[Q+ Matrix-12 WAVE#46+305 Neuron microQkb Andromeda XTk Blofeld]>+ Samples for the Waldorf Blofeld: http://Synth.Stromeko.net/Downloads.html#BlofeldSamplesExtra
[PATCH setup 2/2] Improve file:// url handling
As a repo url, we're accepting * raw windows paths (with both \ and /) c:\cygwin repo \\machine\share\cygwin repo * proper file: urls file:///c:/cygwin%20repo file://machine/share/cygwin%20repo Most non-standard urls accepted by the old code should work, too. Paths longer than 260 characters are not supported anymore. --- netio.cc | 21 ++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/netio.cc b/netio.cc index c8982de..1e784b1 100644 --- a/netio.cc +++ b/netio.cc @@ -25,6 +25,8 @@ #include #include +#include + #include "resource.h" #include "state.h" #include "msg.h" @@ -72,11 +74,24 @@ NetIO::open (char const *url, bool cachable) else if (strncmp (url, "ftps://", 7) == 0) proto = ftps; else if (strncmp (url, "file://", 7) == 0) -proto = file; - else { proto = file; - file_url = (std::string("file://") + url); + + // WinInet expects a legacy file:// url + // (a windows path with "file://" prepended) + // https://blogs.msdn.microsoft.com/freeassociations/2005/05/19/the-bizarre-and-unhappy-story-of-file-urls/ + char path[MAX_PATH]; + DWORD len = MAX_PATH; + if (S_OK == PathCreateFromUrl(url, path, &len, 0)) +{ + file_url = std::string("file://") + path; + url = file_url.c_str(); +} +} + else // treat everything else as a windows path +{ + proto = file; + file_url = std::string("file://") + url; url = file_url.c_str(); } -- 2.16.1
[PATCH setup 1/2] NetIO: Remove unused url parsing code
--- netio.cc | 64 -- netio.h| 11 ++- nio-ie5.cc | 3 +-- 3 files changed, 3 insertions(+), 75 deletions(-) diff --git a/netio.cc b/netio.cc index d60f119..c8982de 100644 --- a/netio.cc +++ b/netio.cc @@ -42,70 +42,6 @@ char *NetIO::net_proxy_passwd; char *NetIO::net_ftp_user; char *NetIO::net_ftp_passwd; -NetIO::NetIO (char const *Purl) -{ - set_url (Purl); -} - -NetIO::~NetIO () -{ - if (url) -delete[] url; - if (proto) -delete[] proto; - if (host) -delete[] host; - if (path) -delete[] path; -} - -void -NetIO::set_url (char const *Purl) -{ - char *bp, *ep, c; - - file_size = 0; - url = new char[strlen (Purl) + 1]; - strcpy (url, Purl); - proto = 0; - host = 0; - port = 0; - path = 0; - - bp = url; - ep = strstr (bp, "://"); - if (!ep) -{ - path = strdup (url); - return; -} - - *ep = 0; - proto = new char [strlen (bp)+1]; - strcpy (proto, bp); - *ep = ':'; - bp = ep + 3; - - ep = bp + strcspn (bp, ":/"); - c = *ep; - *ep = 0; - host = new char [strlen (bp) + 1]; - strcpy (host, bp); - *ep = c; - - if (*ep == ':') -{ - port = atoi (ep + 1); - ep = strchr (ep, '/'); -} - - if (*ep) -{ - path = new char [strlen (ep)+1]; - strcpy (path, ep); -} -} - int NetIO::ok () { diff --git a/netio.h b/netio.h index 7b7d13f..6d0f044 100644 --- a/netio.h +++ b/netio.h @@ -24,8 +24,6 @@ class NetIO { protected: - NetIO (char const *url); - void set_url (char const *url); BOOL ftp_auth; static char *net_user; @@ -39,13 +37,8 @@ protected: public: /* if nonzero, this is the estimated total file size */ int file_size; - /* broken down url FYI */ - char *url; - char *proto; - char *host; - int port; - char *path; -virtual ~ NetIO (); + + virtual ~ NetIO () {}; /* The user calls this function to create a suitable accessor for the given URL. It uses the network setup state in state.h. If diff --git a/nio-ie5.cc b/nio-ie5.cc index 5c93894..6fada0f 100644 --- a/nio-ie5.cc +++ b/nio-ie5.cc @@ -114,8 +114,7 @@ DWORD Proxy::type (void) const static HINTERNET internet = 0; static Proxy last_proxy = Proxy(-1, "", -1); -NetIO_IE5::NetIO_IE5 (char const *_url, bool cachable): -NetIO (_url) +NetIO_IE5::NetIO_IE5 (char const *url, bool cachable) { int resend = 0; -- 2.16.1
Remove legacy networking code, vol 2
[PATCH setup 1/2] NetIO: Remove unused url parsing code [PATCH setup 2/2] Improve file:// url handling netio.cc | 85 ++--- netio.h| 11 ++- nio-ie5.cc | 3 +-- 3 files changed, 21 insertions(+), 78 deletions(-)