LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Can I create and empty directory with installer

I have modified a program executable to run on Windows 7 and I have an ini file that I am putting in the ProgramData\<company>\<app name> directory but I do NOT want to include in the installer. It will be created by the software. Within this ini file is a path pointing to another file that will either be C:\Program Files... or C:\Program Files (x86)... depending on whether or not the software is being installed on Windows 7 x64.

 

So, what I do in software is check if the config file exists (which it wont the first time I run the program ) then check the OS, and create the default the path within that ini file according to the OS I am running on. Then any time the program is run in the future it will load whatever path is there. This gives the user the ability to change it should they want and it will load their changes any subsequent time the program is run. However, in order to do this I want my installer to create the directory structure C:\ProgramData\<company>\<app name> with nothing in it. It seems I can't do this...is there a way to or do I have to just put some empty file in there in order for the directory structure to be created?

Message 1 of 8
(4,991 Views)

Sounds like a good place to put the "Readme" file that nobody is actually going to read...Smiley Wink

Message 2 of 8
(4,979 Views)


@Darin.K wrote:

Sounds like a good place to put the "Readme" file that nobody is actually going to read...Smiley Wink


I actually laughed out loud at that one. Thanks Darin, I'll go that route. Another option is to just create the default ini file with a tag that is called, say "first time" and have that default value be true. I could check if it's true in the startup state in the software and if it is then set the path accordingly. After this is done, switch the boolean to false and write it back to the file.Then I wouldn't have to write the whole file, just change that one line, and the uninstaller would also get rid of the file if the program was uninstalled (I think). If it was created programmatically I don't believe it will. But, this method would require some software changes to make it compatible with the new tag. So, I guess I just have to pick my poison here.

 

 

0 Kudos
Message 3 of 8
(4,974 Views)

You can also run a seperate executable at the end of the installer to put the empty directory in.

 

Or

 

You can change your program so that when it checks for the config file it also checks to see if the folder exists and if it doesn't create it.

0 Kudos
Message 4 of 8
(4,962 Views)

Hi for(imstuck),

 

Clever name by the way.   The best way to accomplish this is to put this functionality in your VI code.   At the beginning of the program, you could have a piece of code that checks to see if that folder structure exists.  If the folder doesn't exist, the code can add that folder and if it does exist, it will just continue with the rest of the program.  

 

Hope this helps!

 

--Starla T

0 Kudos
Message 5 of 8
(4,932 Views)

Is it possible to run a non-LabVIEW application at the end of the installation?  As far as I can tell, it can only be an application that's in the folder that installed application will eventually be installed in.  In this case, it would be really helpful if I could run cmd.exe.

0 Kudos
Message 6 of 8
(4,860 Views)

Hi Jazzdman,

 

You cannot run a non-LabVIEW application at the end of a NI installer automatically.   You could however run it manually.  You could use the System Exec. VI to run an external application inside your VI.  The System Exec VI basically allows you to use the command prompt inside of LabVIEW.

 

--Starla T.   

 

0 Kudos
Message 7 of 8
(4,839 Views)

Hi Starla,

     Thanks for the reply.  I actually managed to achieve an install with the desired app, an empty directory and nothing else.  It was convoluted, I guess, but it does work and it is reasonably flexible.  I did the following:

 

1)  Create a very simple program in LabVIEW with a build specification that allows the program to accept command line arguments.  The one argument it would expect is the directory into which the application is installed.  The application uses the System Exec VI as you suggested, runs a batch script in the background, passes the command line argument to the script and quits.

 

2)  The batch script has echo turned on, creates the empty directory if it does not exist already, pauses so that the LabVIEW program that spawned the

script can leave memory, then deletes the LabVIEW spawn program (i.e. .exe, .ini and .aliases files) and itself.

 

3)  Set up the installer build specification to include the batch script, run the batch script spawn program at the end of the install, and pass it the name of the main app install directory as a command line argument.

 

The next step could be to have the LabVIEW program that spawns the script do the directory creation so that the script would just have to clean up after itself.  But, you could also have a script that would do other stuff that LabVIEW is unable to do.

 

Thanks,

 

Jason

Message 8 of 8
(4,819 Views)