• Which the release of FS2020 we see an explosition of activity on the forun and of course we are very happy to see this. But having all questions about FS2020 in one forum becomes a bit messy. So therefore we would like to ask you all to use the following guidelines when posting your questions:

    • Tag FS2020 specific questions with the MSFS2020 tag.
    • Questions about making 3D assets can be posted in the 3D asset design forum. Either post them in the subforum of the modelling tool you use or in the general forum if they are general.
    • Questions about aircraft design can be posted in the Aircraft design forum
    • Questions about airport design can be posted in the FS2020 airport design forum. Once airport development tools have been updated for FS2020 you can post tool speciifc questions in the subforums of those tools as well of course.
    • Questions about terrain design can be posted in the FS2020 terrain design forum.
    • Questions about SimConnect can be posted in the SimConnect forum.

    Any other question that is not specific to an aspect of development or tool can be posted in the General chat forum.

    By following these guidelines we make sure that the forums remain easy to read for everybody and also that the right people can find your post to answer it.

Path to the "Flight Simulator X files" folder

Messages
47
Country
belgium
Disregard thsi message, found the answer in a different thread....

Hi,

I've created an INS gauge that can read and load FSX flightplans. Up until now I retrieved these flightplans by checking the "Flight Simulator X files" folder in the "My documents" folder. I retrieve the path to the localized "my documents" folder through a standard API call.

I was not aware however that the "Flight Simulator X files" folder name in itself is also localized in different language editions of FSX ! Now I was wondering if there is any way to find this path ?

I checked the registry and it isn't there, FSUIPC also seems to be unable to get the correct path, so is there any other way ?

Thx for helping,
Björn
 
Last edited:
I was hoping that someone would point out the obvious violation of the unwritten flightsim modeller's posting rule:

If you post a question, and find the answer, you MUST post the answer, and not let the readers dangle in suspense!!

(or variation thereof, considering it's unwritten and I made it up a long time ago)
 
Okay - so I didn't search 'Tools - Programming'!:p

-Dai

Since the question was asked in the Gauges forum, I too assumed at first that the answer would be in this forum as well...

...since it wasn't, I widened the scope of the search and found it... :wizard:
 
I wrote something to do that recently. I used the Windows SDK to get the system folder for Documents (Vista) or My Documents (XP) and then I searched the contents for a directory containing "Flight Simulator X" and built the path from that.

I don't have the C code with me right now, but I should be able to dig it out later.

Si

Edit:

This code will get the Windows Documents folder, regardless of whether it's in the default position or whether it's been moved:

Code:
	WCHAR p[MAX_PATH];
	BOOL r = SHGetSpecialFolderPath( 0,
		p,
		CSIDL_MYDOCUMENTS ,
		0);

The resultant path to Documents is placed in P and is wchar type. I can't find the code where I did a search within the path to a specific directory.

Si
 
Last edited:
Of course, there had to be a 'stupid question' follow-up, so this is it: is it always 'Flight Simulator Files' or 'Flight Simulator X Files' in every language?

-Dai
 
Of course, there had to be a 'stupid question' follow-up, so this is it: is it always 'Flight Simulator Files' or 'Flight Simulator X Files' in every language?

-Dai

If you use this code, the question becomes moot, since the check for language.dll will automatically retrieve the precise language specific name:

Code:
  char dll_path[MAX_PATH];
  char FSFilesPath[MAX_PATH];

// assuming FS_Path is a string that contains the path to the FS installation...
  strcpy_s(dll_path,MAX_PATH-1,FS_Path);
  strcat_s(dll_path,MAX_PATH-1,"\\language.dll");
  HINSTANCE hInstLang = LoadLibrary(dll_path);
  if (hInstLang)
  { 
    LoadStringA(hInstLang, 36864, &FSFilesPath[0], 128);
    // FSFilesPath now contains the value of 'Flight Simulator Files" based on language installation
    FreeLibrary(hInstLang);
  }

Combine this with the routine to locate the AppData path, and you should have all you need...
 
That's the one I'm using Bill; I was hoping to do a bit of code chopping by calling from Simon's code to a subroutine for checking for a specific file or folder that I already have.

Okay, so now I come to look it would have saved me exactly two lines of code.... :D

-Dai
 
Back
Top