LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Relative path problem

Solved!
Go to solution

Dear LabViewers,

 

I made a project which plays sound from a wav file. I inserted the file using a path.

I need to send the project to my programming teacher, but the path which works on my computer naturally does not work on his computer.

How can I solve this problem?

Thanks already!

 

Flip

0 Kudos
Message 1 of 6
(2,715 Views)
Solution
Accepted by topic author Zippelaar

The easiest way might be to put both the VI you wrote and the .wav file in the same folder.  There is a VI in the File I/O Palette under File Constants called Current VI's Path.  If you put this into the Strip Path function, you'll get out the path to the Folder of the Current VI (in the top Path output), which is the same as the path to the Folder of the .wav file.  Wire this to Build Path, wiring the Filename of the Wave file (with extension) into the bottom input.  This give you the full path to the Wave file, regardless of where the Folder holding both your VI and the Wave file are located.

 

Bob Schor

Message 2 of 6
(2,710 Views)

Even better is if you are using a project with your VI, you can use Application Directory, which will give you the path of the folder containing the project file.  You can use Build Path from there to create the path for the sound file.  This method is better for files like this since it will still work when you build it into an executable.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Message 3 of 6
(2,658 Views)

Thanks for your help!

I have one more question, how can I put the filename into the build path?

I tried using a constant, but it did not work....

0 Kudos
Message 4 of 6
(2,639 Views)

@Zippelaar wrote:

I have one more question, how can I put the filename into the build path?

I tried using a constant, but it did not work....


You might want to show what you did.  Based on your description, it should have worked.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 5 of 6
(2,634 Views)

Thanks for your help guys,

it turned out that the specs of the .wav file where not correct. I changed it and now it works.

Again, thanks!

0 Kudos
Message 6 of 6
(2,605 Views)