View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0006255 | JEDI VCL | 00 JVCL Components | public | 2014-02-28 20:05 | 2020-05-19 09:39 |
Reporter | Zencode | Assigned To | obones | ||
Priority | normal | Severity | feature | Reproducibility | N/A |
Status | resolved | Resolution | suspended | ||
Product Version | Daily / GIT | ||||
Target Version | Fixed in Version | ||||
Summary | 0006255: Change TJvCABFile.ExtractFile to allow filename override | ||||
Description | The current implementation of TJvCABFile.ExtractFile extracts a file into the destination path using the same relative path and name of the file in the CAB. I am requesting that ExtractFile be changed (or overloaded) to allow a filename override such that the file can be extracted to a specific path and different name regardless of the original. Example: - CAB file contains file "Path\SubPath\file.ext" - invoke ExtractFile('Path\SubPath\file.ext', 'C:\dest') - Assuming the directories exist the following file will be created: C:\dest\Path\SubPath\file.ext However, what if the desired result is for the file to be named "C:\dest\file.ext" or "C:\dest\newfile.newext"? Currently, the only solution is to allow the file to be extracted to the full path and then moved to the new path and name. This isn't hard but it requires extra work and might not always be possible. Since the CAB extraction API already supports this functionality I think it would be nice if TJvCABFile can support it. | ||||
Additional Information | I modified the source to do what I am requesting. The full file with all modifications is attached. Here is an overview of the changes I made: I added a variable 'FDestFileName', overloaded ExtractFile, and modified CExtract to use FDestFileName if present. // Added private variable FDestFileName: string; // Overloaded ExtractFile function ExtractFile(FileName: string; DestPath: string): Boolean; overload; function ExtractFile(FileName, DestPath, DestFileName: string): Boolean; overload; // line 220: function CExtract. Inserted the following code before Path := Sender.FDestPath; if Length(Sender.FDestFileName) > 0 then Path := Sender.FDestFileName else // Added new ExtractFile method function TJvCABFile.ExtractFile(FileName, DestPath, DestFileName: string): Boolean; begin if DestPath[Length(DestPath)] <> PathDelim then DestPath := DestPath + PathDelim; FDestFileName := DestPath + DestFileName; Result := ExtractFile(FileName, DestPath); FDestFileName := ''; // clean up end; ------------------ An alternate approach would be to modify TOnExtractFile to make the FileName argument "var". The downside of this approach is that any existing event handler code would have the wrong signature. | ||||
Tags | No tags attached. | ||||
2014-02-28 20:05
|
JvCabFile.pas (10,036 bytes) |
|
Please provide the zipped sources of a sample application showing the usage |
|
No reply in a timely manner, suspending the issue |
Date Modified | Username | Field | Change |
---|---|---|---|
2014-02-28 20:05 | Zencode | New Issue | |
2014-02-28 20:05 | Zencode | File Added: JvCabFile.pas | |
2014-09-03 11:32 | obones | Note Added: 0021022 | |
2014-09-03 11:32 | obones | Status | new => feedback |
2020-05-19 09:39 | obones | Assigned To | => obones |
2020-05-19 09:39 | obones | Status | feedback => resolved |
2020-05-19 09:39 | obones | Resolution | open => suspended |
2020-05-19 09:39 | obones | Note Added: 0021881 |