Default Zip Location

Mar 11, 2011 at 6:33 PM

I recently started creating self extracting zips from Dot Net Zip instead of Win Zip.

I've noticed the following behavior differences.

Self Extracting Zip is at: C:\Test\test.zip

If I have a process run from : C:\Programs\a.exe, and I run the self extracting zip made by Win Zip from inside that process, files will extract to the location where the zip file exists (C:\Test)

If I have the same setup, but the zip is made from DotNetZip, the files will extract to the process location (C:\Programs\)

 

So my question is, is there anyway to have a self extracting zip made in Dot Net Zip extract to the zip location by default, instead of the calling programs location?

Thanks,

Tim

Coordinator
Mar 11, 2011 at 8:30 PM

If you are doing what I think you are doing, you can set the working directory of the process that you start, to address the problem.

Driver.exe runs, and within that exe, it starts a self-extracting archive.  Driver.exe may set the working directory of the process that runs the SFX.  This should address your need.

 

 

Mar 11, 2011 at 8:39 PM

I had thought of this as a solution as well, but unfortunately I don't have the ability to change my "driver.exe".

I've found a satisfactory workaround though. The folder that I want to extract from is "constant" in that it's always the temp folder, as specified by the environment. So, doing this on creation of the zip seems to help me in my case:

 

SelfExtractorSaveOptions options = new SelfExtractorSaveOptions();                    
options.Flavor = SelfExtractorFlavor.ConsoleApplication;                  
options.PostExtractCommandLine = "setup.bat";                    
options.ExtractExistingFile = ExtractExistingFileAction.OverwriteSilently;                    
options.DefaultExtractDirectory = "%TEMP%";                    
zip.SaveSelfExtractor(finalName, options);

 

Thanks,

Tim

Mar 11, 2011 at 8:44 PM

Actually, not sure if you're a contributor or not, but it would be a nice feature to specify what the working directory is in the save options.

Something like:

SelfExtractorSaveOptions options = new SelfExtractorSaveOptions();                    
options.Flavor = SelfExtractorFlavor.ConsoleApplication;                   
options.PostExtractCommandLine = "setup.bat";                    
options.ExtractExistingFile = ExtractExistingFileAction.OverwriteSilently;                    
options.ExtractWorkingDirectory = ExtractOptions.FileLocation (or ExtractOptions.CallerLocation)            
zip.SaveSelfExtractor(finalName, options);

Thanks,

Tim

Coordinator
Mar 11, 2011 at 9:40 PM

Hmm, yeah that would be a useful addition.

Coordinator
Mar 20, 2011 at 1:36 PM
This discussion has been copied to a work item. Click here to go to the work item and continue the discussion.