How to get the full root directory of a ContentManager in XNA 4.0

纵然是瞬间 提交于 2019-12-06 15:27:41

You may just want to use System.GetFolderPath with one of these locations, most likely Program Files. From there, you can navigate to your application's installation directory. You could also use .Load("\MyFolder\blah") which will load from the default disk (e.g. C:\MyFolder\blah.xnb or whatever).

If you want the path of your .exe file...

using System.IO;
using System.Windows.Forms;

//blah blah
string GetAppDir()
{
    return Path.GetDirectoryName(Application.ExecutablePath);
}
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!