How do I find the parent directory in C#?

后端 未结 15 687
旧时难觅i
旧时难觅i 2020-11-29 05:04

I use this code for finding the debug directory

public string str_directory = Environment.CurrentDirectory.ToString();

\"C:\\\\Us

15条回答
  •  無奈伤痛
    2020-11-29 05:34

    You shouldn't try to do that. Environment.CurrentDirectory gives you the path of the executable directory. This is consistent regardless of where the .exe file is. You shouldn't try to access a file that is assumed to be in a backwards relative location

    I would suggest you move whatever resource you want to access into a local location. Of a system directory (such as AppData)

提交回复
热议问题