LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Retrieve appropriate 'Documents and settings' (or home) folder

I am looking for a way to programatically retrieve the Documents and settings subfolder for a current user, so I can save a .ini file in a Application Data sub-folder (instead of the location where our executable is installed). Can this be done in LabVIEW directly (using 8.20) or do I have to go through the WinAPI ? Ideally, I would also like to be able to find the 'All users' folder inside Document and settings.

I want to do the same for Linux (retrieve home folder), so any suggestions there would also be welcome. No problems to add some C++ code, our software is already supplied with a shared library (dll/so).
0 Kudos
Message 1 of 17
(4,810 Views)

Hi Raistlin,

      (If you haven't already found it) maybe the "Application\Default Data Directory" application property is close enough(?)

Cheers. 

Message Edited by tbd on 03-19-2007 02:42 AM

"Inside every large program is a small program struggling to get out." (attributed to Tony Hoare)
0 Kudos
Message 2 of 17
(4,785 Views)
Thanks for the tip. Although this does not point me directly to the User\Application Data folder, I can just strip path/build path to get to the approriate folder.
0 Kudos
Message 3 of 17
(4,778 Views)
Hi Raistlin,
 
there is an objet in LabVIEW to help you to find the "LabVIEW data" directory located in the document and settings folder of the current user.
I join you a little VI for example. This function can be found in the Function Palette (so on the Block Diagram) under Programming >> File I/O >> File constants and the function is Default Data Directory.
 
Of course this path can be changed in the options of LabVIEW.
 
Regards,
Julien Roland - District Sales Manager
NI Belgium - Technical Support

Don't forget to rate a good answer
Message 4 of 17
(4,760 Views)

Raistlin,

There isn't a direct way (function) to find back the folder you want. So you need to construct the function you want with the built-in tools of LabVIEW.

Regards,

Julien Roland - District Sales Manager
NI Belgium - Technical Support

Don't forget to rate a good answer
0 Kudos
Message 5 of 17
(4,754 Views)
I think you'll find what yyou're looking for under :

HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders

with the key name "Personal".

Shane.
Using LV 6.1 and 8.2.1 on W2k (SP4) and WXP (SP2)
0 Kudos
Message 6 of 17
(4,749 Views)
0 Kudos
Message 7 of 17
(4,744 Views)

Hi Raistlin,

      Julien's suggestion is much "cleaner" than using the app property and appears to return the same path.  Note: I added the following text to Labview.ini:

"DefaultDataFileLocation=C:\"

... and both the App property and the program-constant reflected the new path. Smiley Happy

I'm curious what value is returned for DefaultDataDirectory on a Linux box(?) - and is there a similar file - for instance "LabVIEW.conf" - where LabVIEW's defaults can be set?

Cheers!

 

Message Edited by tbd on 03-19-2007 09:49 PM

"Inside every large program is a small program struggling to get out." (attributed to Tony Hoare)
0 Kudos
Message 8 of 17
(4,719 Views)
I think the default data directory is indeed the way to go. In fact, I do not want a custom directory, so I do not need to change this path. I only want to retrieve it to go to the \User\Application Data\.. folder or the /home/User/... folder. And indeed, it also works on Linux, where the home folder is returned of the current user. So the work to be done is limited using this approach.
0 Kudos
Message 9 of 17
(4,707 Views)

To get to the APPDATA directory, you should use the recommended Windows way of calling SHGetFolderData instead of building and stripping, as this will work in different languages, versions, etc. 

I think I remember seeing an implementation on the LAVA forums.


___________________
Try to take over the world!
0 Kudos
Message 10 of 17
(4,683 Views)