Pregunta

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

¿Fue útil?

Solución

Use Path.Combine to generate absolute path for your subfolder -

string subFolderPath = System.IO.Path.Combine(appdata,"subfolder");

Otros consejos

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.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top