I have my custom application that generates a directory in My documents path, after installation the application uses that directory, but i got an issue in Chinese windows OS, where my application folder name appears in Chinese, so is there any way i can get the file name properly in "en" or some wordaround so that i can that directory name at runtime.
Asked
Active
Viewed 5.6k times
2 Answers
92
Use the special folders in System.Environment
var path = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);
var subFolderPath = Path.Combine(path, "sub folder");

Matthew Hazzard
- 986
- 5
- 5
-
that will give path only upto MyDocuments, i am looking for the directory inside MyDocuments whose name is locale specific. – Vaibhav Oct 01 '11 at 06:17
-
3String path = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + "\\yourFolder"; – tottotech Jun 12 '15 at 13:34
-
6I'd use `Path.Combine()` personally, or at least `Path.DirectorySeparatorChar`. Gotta think of Mono support :p – Nyerguds Sep 29 '17 at 08:16
-
7
String path = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);
then you can append folder name as
string folder ="\\YOUR_FOLDER_NAME\\";
Then append to you path as
String full_path=path+folder;

Gourav Joshi
- 2,419
- 2
- 27
- 45

majana
- 71
- 1
- 1
-
2You should use `System.IO.Path.Combine()` to append two parts of a path. It takes care of the \, you don't have to put any. – Arkane Dec 04 '19 at 16:47