VDSoft / TheTVDBApi

A .NET api for the TheTVDB.com database
GNU General Public License v3.0
5 stars 8 forks source link

Adding option to set file download directory. #6

Closed arbrown closed 9 years ago

arbrown commented 9 years ago

Exposed a property on WebInterface.cs that would allow users to specify a directory to download and extract zip files into. Allows users who do not have necessarily have access to their application default directory (like ASP.NET MVC sites running locally) to specify a different directory to use.

This comes after my previous PR but could be separated into a separate PR if necessary.

arbrown commented 9 years ago

Actually it won't create any subfolders. The dirInfo.FullName call will only get the full name of the directory you have access to write into. Then it still writes the file from the zip using only entry.Name instead of entry.FullName. So, the behavior is exactly the same if you leave FileDirectory empty, and will only change the location of the "loaded.zip" and the "extraction" folder if you specify a directory, but will not change the contents or layout of the file/folder.

Basically, I was trying to use this library in an ASP MVC website, and it was trying to download the zip file to {Application Root}/loaded.zip which ended up being in Program Files and the IIS directory, and the app didn't have the ability to write there. I was able to change the FileDirectory to another directory where I did have write permissions, and it saved loaded.zip there and extracted into a flat file directory just in a different directory.