LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Create a folder structure with distribution kit

Does anyone know how you might be able to create an empty folder (directory) on the target using the CVI 6 CDK? E.g., I'd like to have an empty "log" folder created on the target drive (and note that you may not know the target drive ahead of time). The CDK insists on having at least one file in a group, and doesn't seem to want to accept a folder (i.e. directory name) as a file. I'm working with an existing app and I'd like to NOT have to go in and hardcode directory creation.

And while I'm on the topic, not being able to include registry entries directly into the kit using the CDK is a genuine PITA. Now I've got to go buy other tools to handle a simple task like registry entries!? This is NOT cool ...

I'm startin
g to think NI went backwards when they switched over to the WIT CDK ... look at the huge volume of questions here on the forum on this one topic alone ...
0 Kudos
Message 1 of 5
(3,320 Views)
Hello,
You can create a small executable that calls MakeDir function, and run that executable right after Setup was run. In Create Distribution Kit wizard, You can click Advanced button, and specify that small executable to run after Setup. This will create an empty directory on the target machine.

Mika Fukuchi
Application Engineer
National Instruments
0 Kudos
Message 2 of 5
(3,320 Views)
Greetings,

You are correct - you cannot create an empty directory in a straightforward manner from the CDK UI. Here's a few suggestions:

If you're in a situation where you can modify the application, you could use the GetProjectDir() function along with the MakeDir() function at application startup to make the directory for you. GetProjectDir() returns the directory that you're running from, and you could append "\\log", then call MakeDir() to create that directory.

Another way would be to create a small DOS batch file that you would include in your CDK build, which would create the directory for you. If you look at the help under the Advanced button on the CDK, you see that there are some predefined parameters that can be passed to your application - including installation dir. Knowing this, you could create a batch file called "foo.bat", included it in your CDK build, and schedule it for execution under the advanced option, and pass it a command line parameter of %dest (other possible command line arguments in the help). Foo.bat might look like this:
@echo off
mkdir "%1\log"

For registry entry creation, there is a variation on the last tip to programmatically create registry entries (we ship a sample that shows this: CVI\samples\apps\regadd). You could add this code to your application, again scheduling it for execution at installation time (passing it the %dest option if you need it).

However, especially for the registry key question - it's moderately easy to modify the CDK using a free database editor tool, such as Microsoft's Orca (getting this setup the first time is the most painful part). If you haven't already read the CDK modification appnote, you should probably start there - also available online at: http://zone.ni.com/devzone/conceptd.nsf/webmain/2FF2B17F4DC7CFDF86256AA3006990C4?opendocument. You can download Orca from Microsoft, via the platform SDK, Windows installer option (once downloading the SDK, you might have to manually install Orca.msi, often in \Microsoft Platform SDK\Bin\). The documentation for the various MSI tables comes along with the SDK, and should have the information you need. In particular, you'll need to make entries in the Registry table, tying each row back to one of your installed files in the Component table.

Hope this was helpful, and please reply if you need more information on the specifics of any of the above.

Regards,
- WesW / NI
0 Kudos
Message 3 of 5
(3,320 Views)
One additional idea on the registry key is that you could create a registry export file (.reg) using regedit, and include that as file in your CDK. You could then create a batch file (that you would include and schedule to run in the the CDK), that would run regedit.exe /S , which silently imports the .reg file you included on the target machine. You would probably want to use the %dest tip from above in your batch file so that regedit could file the file.

- WesW / NI
0 Kudos
Message 4 of 5
(3,320 Views)
Wes-

Thanks very much for the info and the thought you put into this. I didn't know if it was kosher for an "enthusiast" to ask a question and then complain too 😉

If it hadn't been so straightforward to include registry entries in the previous rev of CVI, I guess I would be more amenable to the work-arounds required by the 6.0 CDK.

I settled for including an empty "placeholder" file in each of the directories I needed, and so I get my directory structure and we just ignore the placeholder files.

And I have been doing much as you suggested for the registry entries, creating a group with a .reg file in it that I have the installer "manually" enter by double clicking the .reg file after the installer finishes.

Thanks again Wes, mayb
e you'll be able to beef up the CDK in some of these areas in the future.
0 Kudos
Message 5 of 5
(3,320 Views)