12-08-2011 08:33 AM
I'm trying to build an executable that will look up an external file to get input parameters. In the vi that will be made into the executable I place the external file name in a path relative the the vi path. When I build the executable and run it, it can't find the file. How do I rectify this?
I tried putting the file into always included and the support directory the same as that where the executable is, but still not working.
Regards,
Leeser
12-08-2011 08:34 AM
12-09-2011 09:01 AM
I tried the solutionas suggested but it only partly worked.
yes it obtained the relative path of the file I wanted. However, this file contains details for an absolute path eg
...
inputs_folder,C:\input_data
....
So a routine (subvi) scans the text file and finds "inputs folder" and returns "C:\input_data" and turns it into a base path. This is then combined with the build_path vi and a filename to get an absolute path to a specific file. However, Erro7 occurs as it cannot find the file. It works in the development version but not in the executable version.
I want to have absolute paths as the directory structure is not known beforehand and so it can be changed at will.
Anyone any suggestions?
Regards,
Leeser
12-09-2011 09:25 AM - edited 12-09-2011 09:29 AM
to do this you either:
must install a directory at the designated absolute path or
place some code in your application the creates the file and path structure if it does not exist<< the file exists function is a good thing to use to see if you need to call the sub-vi that writes the file with default data
Optionally there is nothing wrong with using the default data directory C:\program data(\Myapp\)
12-09-2011 09:30 AM
Thanks for your suggestion but the directory is already existing and so are the specific files in that directory.
The executable simply has to go to the said directory and file and read it (spreadsheet file) and then populate a control...
I am at a loss...it works in the development version but not in the executable....
12-09-2011 09:34 AM
Can you post your code, or at the very least a screenshot? Please post screenshots in PNG/JPEG/GIF format. DO NOT POST BITMAPS. Remember: renaming a .bmp file to .png does NOT magically change its format.
12-09-2011 09:55 AM
Hi,
It's a very complex vi using JKI State Machine Template so I have attached what I think is relevant snippets...
This shows the initial correction as suggester by Mercurio and which works to get the relative reference path correct. This allows me to read in the data from a text file shown in the next image..
so the stripped path and build path with the name of the text file is fed into the "get" vi and it returns the text from the text file into the cluster on the right. In the development version the folders.wafer-data absolute path is correct and so is Motor data.surface_data text value. These are then used at a later stage as in the next snippet
It works in the development verison but not the executable.
I don't want to hardwire the absolute path into the coding but want it accessible and changeable external through the text file.
12-12-2011 04:15 AM
Ok, I made a simple vi of the basic process and have attached it here along with the text file it scans to get the paths. The previous figures may not have been clear...
It works both in the development and the executable version. This means that in my complex vi I have made an error somewhere. But as it works in the development version but not the executable version this would imply that my coding is not horribly wrong.
Is there any way of stepping through the executable like in highlight mode? Maybe that way I can find the error.
Leeser
12-12-2011 04:23 AM
Got off my ass and did a quick search for "debugging executables" and got the following, sorry if I wasted anyone's time...
http://digital.ni.com/public.nsf/allkb/3087D91EEADBAF3D862571D1004AF192?OpenDocument
http://digital.ni.com/public.nsf/allkb/8DA679805915DE40862572D5007B2F70?OpenDocument