picklecolor2 Posted September 29, 2009 Report Share Posted September 29, 2009 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: 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 Quote Link to comment
Kurt Friday Posted September 30, 2009 Report Share Posted September 30, 2009 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: 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 Quote Link to comment
gmart Posted September 30, 2009 Report Share Posted September 30, 2009 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. Quote Link to comment
picklecolor2 Posted September 30, 2009 Author Report Share Posted September 30, 2009 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! Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.