On 14-08-31 07:38 AM, Enrico Tröger wrote:
On 30/08/14 03:04, Matthew Brush wrote:
On 14-08-29 07:24 AM, Enrico Tröger wrote:
[snip]
I'd implement this way first, based on your patch, and if we want, we
can change to .../Local later anyway if desired.


I think it's probably the easiest solution, with the least code, and
most compatibility. If you don't feel like coding it yourself, let me
know and I can whip up a (real/working) function to do it. I've been
doing a fair bit of Win32 API coding lately so it's fresh on my mind, I

I don't mind, if you like to do it, I'd be happy to test the result :).


Attached is a function that works standalone, it could drop into the
previous patch where the untested/working function was. I have only
tested on WinXP. If you don't feel like putting it together manually, I
can eventually commit it all together properly once I figure out my
build system issues.

Tested on Windows 7:

I had to change the function to its multibyte variant:

SHGetFolderPathAndSubDirW


That's the wide character variant, the ASCII one is the A function. You should be able to just use the non-char-specific one as long as we're telling the Win32 API we're using the wide API (I assumed we were since I saw other code in win32.c using wide characters). You need to #define UNICODE or _UNICODE (I always forget) before including "windows.h" to make it work normally/automagically.

Attached is the header I always use to wrap up the Win32 API include/defining weirdness that seems to "just work" with Unicode without any fuss.

Otherwise it spat out compiler warnings and the resulting config
directory was:

  㩃啜敳獲敜牮捩屯灁䑰瑡屡潒浡湩屧g旄

:).


Additionally, I had to add the flag CSIDL_FLAG_CREATE so that the
...\Roaming\geany folder is created initially if it doesn't exist yet.
Without that flag, SHGetFolderPathAndSubDirW() would fail if the folder
doesn't exist.

That should be fine I would think. I just assumed other Geany code dealt with creating it.

Alternatively we could maybe use the flag CSIDL_FLAG_DONT_VERIFY since
we create the folder in Geany at a later point anyway. Though I didn't
test this flag because I guess it's better if Windows creates this
special folder.


Not sure, I suppose it's fine either way.

Attached is the trivial diff of my changes to your confdir.c.

So, if my modifications work also on your Windows XP, I'd say go ahead
and commit your changes and I will start to build the installer.


Will test soon, but just looking they should be fine.

Cheers,
Matthew Brush

#ifndef __WIN32API_H__
#define __WIN32API_H__

#undef UNICODE
#undef _UNICODE
#undef VC_EXTRALEAN
#undef WIN32_LEAN_AND_MEAN
#undef _WIN32_WINNT

#define UNICODE 1
#define _UNICODE 1
#define VC_EXTRALEAN 1
#define WIN32_LEAN_AND_MEAN 1
#define _WIN32_WINNT 0x0501

#include <windows.h>
#include <commctrl.h>
#include <shellapi.h>
#include <wchar.h>

#endif // __WIN32API_H__
_______________________________________________
Devel mailing list
Devel@lists.geany.org
https://lists.geany.org/cgi-bin/mailman/listinfo/devel

Reply via email to