My Documents directory

  • Thread starter Thread starter Nathan Mellor
  • Start date Start date
N

Nathan Mellor

Does every Pocket PC have a "My Documents" directory. Should I feel
uncomfortable hardcoding a file open for "My Documents\\MyApp.txt"? Is there
some Property I should look for instead?

Nathan
 
You have two options to get My Documents:- either call P/Invoke
SHGetSpecialFolderPath by yourself or use
OpenNETCF.EnvironmentEx.GetFolderPath(SpecialFolder.Personal).
 
You can always set path at runtime also. The folloing will give u path of
your application. You can create file using this string and read from the
path also.sCurrentPath is of string type.#If PPC Then
_sCurrentPath = _

System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssem
bly.GetName.CodeBase)
#Else
_sCurrentPath = _

System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssem
bly.Location)
#End If"Sergey Bogdanov said:
You have two options to get My Documents:- either call P/Invoke
SHGetSpecialFolderPath by yourself or use
OpenNETCF.EnvironmentEx.GetFolderPath(SpecialFolder.Personal).

--
Sergey Bogdanov [.NET CF MVP, MCSD]
http://www.sergeybogdanov.com


Nathan said:
Does every Pocket PC have a "My Documents" directory. Should I feel
uncomfortable hardcoding a file open for "My Documents\\MyApp.txt"? Is there
some Property I should look for instead?

Nathan
 
Sounds good, but there is a note that it doesn't work in Pocket PC 2002. Is
this still the case?

Nathan

Sergey Bogdanov said:
You have two options to get My Documents:- either call P/Invoke
SHGetSpecialFolderPath by yourself or use
OpenNETCF.EnvironmentEx.GetFolderPath(SpecialFolder.Personal).

--
Sergey Bogdanov [.NET CF MVP, MCSD]
http://www.sergeybogdanov.com


Nathan said:
Does every Pocket PC have a "My Documents" directory. Should I feel
uncomfortable hardcoding a file open for "My Documents\\MyApp.txt"? Is
there some Property I should look for instead?

Nathan
 
Nope, for PocketPC 2002 it all the same returns "\My Documents".


--
Sergey Bogdanov [.NET CF MVP, MCSD]
http://www.sergeybogdanov.com


Nathan said:
Sounds good, but there is a note that it doesn't work in Pocket PC 2002. Is
this still the case?

Nathan

You have two options to get My Documents:- either call P/Invoke
SHGetSpecialFolderPath by yourself or use
OpenNETCF.EnvironmentEx.GetFolderPath(SpecialFolder.Personal).

--
Sergey Bogdanov [.NET CF MVP, MCSD]
http://www.sergeybogdanov.com


Nathan said:
Does every Pocket PC have a "My Documents" directory. Should I feel
uncomfortable hardcoding a file open for "My Documents\\MyApp.txt"? Is
there some Property I should look for instead?

Nathan
 
Back
Top