News:

Simutrans Tools
Know our tools that can help you to create add-ons, install and customize Simutrans.

[Haiku] use find_directory instead of getenv to determine home directory

Started by taos, August 16, 2015, 06:22:25 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

prissi

SHGetFolderPath is also used for the program directory in simwin_w just below. If MSVC 2015 does not compile SHGetFolderA, then obviously we need to change this. But obtaining the program folder did works. Hence if we use it in one place, why not using it in the other?

And SHGetFOlderPath compiled on older systems is a dynamical linked function; hence this function will not be removed from the kernel until all 32 bit applications die out (maye around 2025 given how long 16 bit programs did work).

Ters

Quote from: prissi on September 02, 2015, 08:56:35 PM
And SHGetFOlderPath compiled on older systems is a dynamical linked function; hence this function will not be removed from the kernel until all 32 bit applications die out (maye around 2025 given how long 16 bit programs did work).

It is still a dynamically linked function (well SHGetFolderPathA and SHGetFolderPathW are, SHGetFolderPath is and has always been a macro). As far as I know, everything in Win32 is either that or a COM interface. (And it's not part of the kernel. The kernel API is mostly undocumented, apart from what drivers use.)

Curiously, the predecessor to SHGetFolderPath, SHGetSpecialFolderPath, is still documented on MSDN despite being replaced, and likely deprecated, 15 years ago. I'm not sure when support ended, but it's clearly of the "it might still work, but we won't help you if it doesn't (except when we do)" kind if one knows Microsoft's history of compatibility. (Not that there is any reason for us whatsoever to even consider using SHGetSpecialFolderPath anymore.)

jamespetts

I managed to get this to compile on MSVS 2012 by adding the following line to simsys.cc (in the #ifdef _WIN32 section):

#   include <shlobj.h>      // needed for SHGetFolderPath()
Download Simutrans-Extended.

Want to help with development? See here for things to do for coding, and here for information on how to make graphics/objects.

Follow Simutrans-Extended on Facebook.

prissi

Which you are talking of? simsys.cc already used SHGetFolderPath and included the latter? simsys_posix should not need any of this, as it uses simsys.cc too (if everything is compiled as intended.)

jamespetts

I refer to simsys.cc - my copy (for Experimental) did not include slobj.h, and adding this line allowed it to compile - if this had already been added to Standard and I managed to miss it for Experimental, then this may not assist with issues in Standard (which I had inferred was that MSVS 2015 was not compiling with this line) as much as I had hoped.
Download Simutrans-Extended.

Want to help with development? See here for things to do for coding, and here for information on how to make graphics/objects.

Follow Simutrans-Extended on Facebook.

Ters

shlobj.h was added to simsys.cc over a year ago, in order to locate the font directory.

jamespetts

Ah - I appear to be behind. Perhaps this is because I have never managed to merge the GUI themes code?
Download Simutrans-Extended.

Want to help with development? See here for things to do for coding, and here for information on how to make graphics/objects.

Follow Simutrans-Extended on Facebook.

Ters

It is curious that despite lots of changes having been done to how Simutrans gets the documents directory on Windows, the request that started the Windows-related changes, that we should not go digging into the registry for undocumented registry keys, has not been acted upon. Despite being the most likely not to work, it is still in there as a Plan B.