[PATCH 0/8] Fix broken file paths on Win32

Lubomir I. Ivanov neolit123 at gmail.com
Wed Dec 18 14:46:58 UTC 2013


these changes were discussed previously about the broken
support for paths with special characters on win32.

this proves again that Windows is bad about the UTF-16 choices
they've made and not very portable in the long run for M/P software.

the provided solution is in C and in the backend.
the Qt/QFile alternative of re-writeing file.c could be
much cleaner, but i don't really see how that will happen
without re-writing other parts to use QFile as well and merging the
frontend and backend a bit more.

also zip_open() is still an issue, because their API
is partial:
1) no way to read buffers
2) no way to read a wchar_t path

some notes:
- the changes in uemis-downloader.c are untested [6].
- the sqlite3 wrapper is untested (i don't think i have such
files to test with either way) [2].
- [8] the zip_open() wrapper is based on zip_fdopen()

regarding [7] and the webservices code:
if an user has decided to install windows in a strange path
such as the test thiago gave e.g. C:\?G??\temp instead of c:\widnows\temp,
then possibly this will brake not only subsurface but other software
as well.

following this logic, we don't need to change the zip_open()
calls in the webservices when uploading to divelogs.de to be the
wrapped version and also possibly the same when downloading.

but one pitfall of the zip_open() wrapper logic is that we can no longer
create a zipfile in a weird path, because the wrapper with _fdopen makes
it read-only. so ZIP_CREATE should be used on a file in a temp/safe path
and the same file should be copyed into the target path and the original
unlinked.

browsing trough the code we don't actually preserve the ZIP
format of files such as DLD, which is a bit odd, but if we decide
to write and create zip files then a zip_create() method will be needed
that solves the described above issue.

lubomir
--

[PATCH 1/8] Files: use UTF-8 names when opening and importing
[PATCH 2/8] Files: add wrappers for open(), fopen(), sqlite3_open()
[PATCH 3/8] Maintab: fix a warning about missing parentheses
[PATCH 4/8] Files: add a wrapper for opendir()
[PATCH 5/8] Files: use the wrappers for fopen() and open()
[PATCH 6/8] Files: some win32 changes in uemis-downloader.c
[PATCH 7/8] Webservices: use toUtf8() when dealing with files
[PATCH 8/8] Files: add a wrapper for zip_open() on Win32


More information about the subsurface mailing list