Use Path.Combine
to generate absolute path for your subfolder -
string subFolderPath = System.IO.Path.Combine(appdata,"subfolder");
Question
I want to extract with SharpZipLib to extract.
I use this for extract on %appdata
% but i want to extract in a subfolder of Roaming
string appdata = System.Environment.GetFolderPath(
System.Environment.SpecialFolder.ApplicationData)
My question is how I extract to %appdata%\subfolder
?
Thanks
Solution
Use Path.Combine
to generate absolute path for your subfolder -
string subFolderPath = System.IO.Path.Combine(appdata,"subfolder");
OTHER TIPS
I guess there's two ways of doing this really, one using string concatenation and the other using using Path.Combine
string folder = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + @"\subfolder";
Or
string folder = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "subfolder");
Personally I am not sure which is the "better" option, I guess when it comes down to it they do the same thing.