キャンセル
次の結果を表示 
次の代わりに検索 
もしかして: 

Relative path problem

解決済み
解決策を見る

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 件の賞賛
メッセージ1/6
3,622件の閲覧回数
解決策
受理者 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

メッセージ2/6
3,617件の閲覧回数

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.



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
メッセージ3/6
3,565件の閲覧回数

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 件の賞賛
メッセージ4/6
3,546件の閲覧回数

@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.



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 件の賞賛
メッセージ5/6
3,541件の閲覧回数

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 件の賞賛
メッセージ6/6
3,512件の閲覧回数