LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Searching for configuration files

Solved!
Go to solution

I have a set of CSV files which I need to read on the startup of my main VI or the executable built from my main VI and all its dependencies (Either under WIndows 7 or LabView RT).  Effectively, I need to search for these CSV files in a programmatic search path such as:

 

.\*.csv

..\config\*.csv

<project path>\config\

 

What is the recommended strategy for this and are there any VIs available for searching an arbitrary set of absolute and relative paths?

 

Also, how would this be handled in an AB exe build (EX: Can resource files be enbedded in an EXE)?

 

For LabView RT, I currently just have a deployed resource directory under c:\config.  That works fine for RT, but it's a horrible way to do it on a Windows PC.  Looking for a smarter approach.

 

Thanks,

 

XL600

 

 

0 Kudos
Message 1 of 11
(3,379 Views)

There is the Recursive File List.vi which will search the directory you told it and any subfolders as well.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 2 of 11
(3,358 Views)

Is there a way to locate a folder (Virtual or auto-populating) by a specific name within the current VI's project?  I'd like to combine that with a recursive search to give me the ability to point to a spcific config folder within the project while also allowing me to deploy a config directory to a path during executable builds.

 

Something like:

 

  • Determine the development mode
  • Get the name of the project containing the current VI (If running from a project)
  • Find the config folder within the project
  • Determine the absolute path of the project folder

I haven't been able to locate any basic function to give me the current VI's project path.

 

Thanks!

0 Kudos
Message 3 of 11
(3,349 Views)

@xl600 wrote:

I haven't been able to locate any basic function to give me the current VI's project path.


I think what you are looking for here is Application Directory.  It returns the folder containing the project file (when in development mode) or the directory containing the executable (when in Run Time Engine).


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 4 of 11
(3,334 Views)

In typical fashion, the Application.Directory property node returns the LabView executable path while the file constant Application Directory returns the path the project is in (In dev mode).  But what returns the project name suitable for the Project.Open invoke node?

0 Kudos
Message 5 of 11
(3,328 Views)

@xl600 wrote:

In typical fashion, the Application.Directory property node returns the LabView executable path while the file constant Application Directory returns the path the project is in (In dev mode).  But what returns the project name suitable for the Project.Open invoke node?


No, the Application Directory will give you the directory of the executable.  You do not need the property node at all.

 

From the detailed help for the Application Directory VI:


 

If you call this VI from a stand-alone application, this VI returns the path to the folder containing the stand-alone application.

 

If you call this VI from the development environment and the VI is loaded in a LabVIEW project file (.lvproj), this VI returns the path to the folder containing the project file. If the project is not saved, this VI returns <Not a Path>.


 


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 6 of 11
(3,322 Views)

Thanks again for the info!  It looks like nothing will provide the enclosing project name then?

 

 

0 Kudos
Message 7 of 11
(3,283 Views)

@xl600 wrote:

Thanks again for the info!  It looks like nothing will provide the enclosing project name then?


Why do you need the project name?  All you need is a relative path from the project's directory and you can search for your configuration files from there.  This way it will work in both the development and run time modes.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 8 of 11
(3,280 Views)

For the directory search, yes.  That's what I coded up yesterday.  I was also thinking about adding a project based search where I could create a virtual (Non-autopopulating) config or resources folder and populate it with files from various locations.  Then I would add the virtual folder name to the search list.  But getting the current 'enclosing' project name doesn't seem to be possible outside of application builder.

0 Kudos
Message 9 of 11
(3,266 Views)
Solution
Accepted by topic author xl600

You can get a list of project items:

This application is not control, it is "VI server reference" constant From Application control Pallette with "This application" selected. Why does making snippet do this?

get project items.png

0 Kudos
Message 10 of 11
(3,253 Views)