开发者

use correct path of folder in win app

开发者 https://www.devze.com 2023-01-16 01:34 出处:网络
I write a win app,now i want to make setup for my app project.i have a 开发者_如何学编程folder in the

I write a win app,now i want to make setup for my app project.i have a 开发者_如何学编程folder in the root path of my project and it contains some wave files that i use theire path in my app like: "F:\test\Resources\1.wav". now my queistion is: how can i use their path in correct format ,that if i install setup file,on another computer my app works true ,only because of the path of the wave files.

thanks alot for your attention.


You can get your EXE's path by calling System.Reflection.Assembly.GetExecutingAssembly().Location.

Alternatively you could store you install path in the registry somewhere with the installer and then you can check that registry entry.


You can useApplication.StartupPath, and append your subfolder.

So something like Application.StartupPath + @"\Resources\1.wav" should do the trick.

This is without Reflection, so I guess it will be a little faster, but I haven't benchmarked it.

0

精彩评论

暂无评论...
验证码 换一张
取 消