Jump to content

Executable "Preserve disk hierarchy" option changed in 2009


Recommended Posts

I'm having trouble with a build that worked in 8.5.1, but breaks in 2009. What I have is a VI that traces back to the root VI when developing or the .exe if built. I want to read from an .ini that's in the same folder as either the root VI or executable. The code I have is attached.

The problem seems to be in a project containing this file. If I compile in 8.5.1 and this file is three VIs deep in the hierarchy it still returns "C:\OneDirectory\TwoDirectories\Config.ini", but if I compile in 2009 it returns "C:\OneDirectory\TwoDirectories\Application.exe\FoolishDirectory\Borkborkbork\Config.ini". I think it is because of a change in the default option for "Preserve disk hierarchy" in the executable build:

post-16509-125426178169_thumb.jpg

I can't figure out how to change this, but it is different between 8.5.1 and 2009. Can anyone help me with a correction, or maybe a work around? I'd be much obliged.

Code:mvcfgConfigPath.vi

Link to comment

I'm having trouble with a build that worked in 8.5.1, but breaks in 2009. What I have is a VI that traces back to the root VI when developing or the .exe if built. I want to read from an .ini that's in the same folder as either the root VI or executable. The code I have is attached.

The problem seems to be in a project containing this file. If I compile in 8.5.1 and this file is three VIs deep in the hierarchy it still returns "C:\OneDirectory\TwoDirectories\Config.ini", but if I compile in 2009 it returns "C:\OneDirectory\TwoDirectories\Application.exe\FoolishDirectory\Borkborkbork\Config.ini". I think it is because of a change in the default option for "Preserve disk hierarchy" in the executable build:

post-16509-125426178169_thumb.jpg

I can't figure out how to change this, but it is different between 8.5.1 and 2009. Can anyone help me with a correction, or maybe a work around? I'd be much obliged.

Code:mvcfgConfigPath.vi

The problem is due to exe's now requiring an internal directory structure so they can handle building projects that contain classes or library's. So you want a solution that can check if the directory is internal to the exe. I had a play and found that the Get File Type.vi is able to return the type as Directory if the directory is outside the exe and Invalid if it is inside. I've modified your code to show this.

mvcfgConfigPath_KF.vi

Link to comment

There is a VI in the File I/O>>File Constants palette - Application Directory - that will return the path to the directory containing the application. This will work in the development environment as well as an application. You can use this VI to build the appropriate path to your ini file.

Also, there is an option in the Advanced page "Use 8.x file layout" that will keep the layout of the application flat. It is mainly there for compatibility since the hierarchy layout is the standard.

Link to comment

It's nice to know that even though all my old tools are breaking, I've been supplied with new tools that are even easier. The Application Directory VI works perfectly. I was frustrated that I hadn't checked for such a feature before and didn't find it in 8.5.1. Good to know I'm not a total dummy, just unfamiliar with the features of 2009.

Thanks to you both!

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.