LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Default directory "defaults" to original value

I have my default directory set to a network location where there are files necessary to run the application.  When the network is down. i want to be able to use a backup set of files on the C:\ drive.  To detect that the network is down, I am checking the default directory path to check that it is valid, however, when the network is down and labview starts, it reverts to the NI selected "default" directory.  Is there a way I can stop Labview from reverting to the "factory default" default directory if the preferred default directory is not available?
Labview is not loaded in the same directory on all my computers that run this application and so the "default" default directory is not the same.
 
I have other ways that I could make this work, but to make the application as robust as possible I would like to check the validity of the default file path and not have it change to an "uncontrolled" path arbitrarily.
 
Thanks, -- if any one has seen this or has a way to prevent this from happening, please let me know.
 
Tom 
0 Kudos
Message 1 of 10
(3,540 Views)
Hi Tom,
I'm having difficulties understanding exactly what you are looking for. How are you setting the directory where this application is pointing you?  When you were talking about your application, are you talking about a VI you have written?  Have you tried to change the VI Search Path in Tools->Options->Paths->VI Search Paths (in drop down menu)? You can add as many VI search paths as you want.
Let me know if this is what you are looking for.

Yi Y.
Applications Engineer
http://www.ni.com/support
0 Kudos
Message 2 of 10
(3,516 Views)
Hi Tom,
 
As far I know, the 'default' directory for LabVIEW.exe is the folder where LabVIEW.exe is residing. So when you create an application and install it some where in your hard disk, the so called 'default' directory is the folder the application is installed.
 
Could you tell as actually how do you set your default directory to a network location.
 
Regards,
Deepu
 
0 Kudos
Message 3 of 10
(3,513 Views)

                      " Have you tried to change the VI Search Path in Tools->Options->Paths->VI Search Paths (in drop down menu)?"


This is how I changed the default directory.  (See photo)  This allows me to use the function "default directory" to point to the path where information is stored. (see second photo)  The application is an .exe created from a program written in labview with a top level and numerous lower level vi's.  When the network goes down and the application (or labview on my base computer) is started, the default directory does not return a bad linkage or <not a path>.  It reverts to the "original" default directory that was populated during initial loading of Labview on the computer.  Since I need to know when this path is not the desired path, how can I prevent (or detect) when Labview changes the default directory back to the original. 

 

Also, if the network comes back on-line and the apllication (or Labview on my base computer) is shutdown and restarted it reverts back to the desired default.  So, when the application starts up, it is checking the path and if the path is not good, it is deciding on its own to select the "factory" default directory.  I would like to be able to program the application to use a programmer controlled backup directory rather than the National Instruments controlled default directory, if the desired default directory has an invalid (temporarily non-existant) path.

 

Thanks,

Tom

Message Edited by Tom Haggerty on 07-12-2007 07:25 AM

Message Edited by Tom Haggerty on 07-12-2007 07:26 AM

Download All
0 Kudos
Message 4 of 10
(3,501 Views)
Hi Tom,
I tried it out, and it doesn't appear that there's a way to change the back up setting if the specified directory is not found.  I will do more research and get back to you with my findings.
Thanks!

Yi Y.
Applications Engineer
http://www.ni.com/support
Message 5 of 10
(3,470 Views)

Thanks for the info.  Is there at least a way to tell if Labview had to revert to the original?  And is there a way to reset the default once the desired directory comes back without shutting down.

 

I think this would be a good feature to add... Allow The default directory to change back to the desired when it's available.  I don't like the idea that the operator must close and restart Labview in order to reset the default directory back to the desired path.  I think this is a different situation than changing the desired path.  I understand in order to change the desired path, one must restart Labview in order for the changes to take affect.... But if the desired path is not used by Labview because it is unavailable at the time of startup, I think the path should be settable (only back to the intended target) once the path becomes available.

 

I am trying to code how to handle when the network is down.  I have written a way to detect that the network is unavailable and I pull the config and setup files I need from a backup location.  I also store collected data in the backup location, however when the network comes back, I need to synchronize the backup location back to the desired storage location for the data  files.  And without being able to reset the desired path in Labview, I cannot do this automatically in the program... This makes the data collected at risk for being lost or overwritten.

 

Tom

0 Kudos
Message 6 of 10
(3,458 Views)
The default directory can be read (but not written) via a property in the Application class.
Maybe I'm missing something, but I cannot understand why you are relying so heavily on this directory. If all your working files are gathered in a single directory, you may define a global variable containing the path to this folder. Whenever you need to open one of such files, you should explicitly build the file path using the global. This global would be easily changed to a local path when your program senses that the network is down.
Paolo
-------------------
LV 7.1, 2011, 2017, 2019, 2021
0 Kudos
Message 7 of 10
(3,454 Views)

Hind sight is 20/20Smiley Very Happy

I know there are work arounds, but I programmed this way with an expectation as to how the program would work.  Now that the program does something unexpected, I would like to know the reason and the ways I can correct it. 

My thought originally was that if I had to change the location of the setup files for some reason, I could just change the default directory in options and I wouldn't have to rebuild the .exe and reload it everywhere it was used.  It turns out that we have lost the ability to change the default directory on .exe's any way (in labview 😎 so the use of the default directory in the way that I am using it is not as desirable as it once was.

 

Tom

0 Kudos
Message 8 of 10
(3,449 Views)
Hi Tom,

My research result backs up what Paolo said, which is that the default directory cannot be changed programmatically, and there's currently no way to set the back up default directory should the user specified default is not accessible.  The reason that it is disabled is probably because allowing users to change the default directory when the program is running can cause unexpected behavior.  However, I think it would be a good idea to allow user to configure a back up default directory.  Please do make a product suggestion at our website at http://www.ni.com/contact.  R&D will look at all product suggestions and take it into consideration in the future releases of LabVIEW.
Hope this information helps!

Yi Y.
Applications Engineer
http://www.ni.com/support
0 Kudos
Message 9 of 10
(3,438 Views)
Ok, Thanks for the help.
 
Tom
0 Kudos
Message 10 of 10
(3,417 Views)