Skip to content

Commit

Permalink
unzip symlink
Browse files Browse the repository at this point in the history
  • Loading branch information
miyako committed Sep 10, 2019
1 parent 7feeebd commit e57f827
Show file tree
Hide file tree
Showing 18 changed files with 45 additions and 46 deletions.
25 changes: 13 additions & 12 deletions zip/4DPlugin-Zip.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -434,7 +434,7 @@ void Unzip(PA_PluginParameters params) {
if(relative_path.at(relative_path.size() - 1) == folder_separator)
{
create_folder(absolute_path);
}
}else

//a folder (by attribute)
if(((zi->external_fa >> 16L) & 0x4000) == 0x4000)
Expand All @@ -456,19 +456,20 @@ void Unzip(PA_PluginParameters params) {
if(read > 0)
{
std::string symlink_absolute_path = absolute_path;
NSString *_symlinkSrcPath = (NSString *)CFStringCreateWithFileSystemRepresentation(kCFAllocatorDefault, symlink_absolute_path.c_str());
symlink_absolute_path = absolute_path_t([[_symlinkSrcPath stringByDeletingLastPathComponent]fileSystemRepresentation]);
[_symlinkSrcPath release];
symlink_absolute_path += folder_separator + std::string((char *)&_buf[0]);
NSString *symlinkDstPath = [[NSString alloc]initWithUTF8String:symlink_absolute_path.c_str()];
[symlinkDstPaths addObject:symlinkDstPath];
[symlinkDstPath release];

NSString *symlinkSrcPath = [[NSString alloc]initWithUTF8String:absolute_path.c_str()];
[symlinkSrcPaths addObject:symlinkSrcPath];
[symlinkSrcPath release];
NSString *symlinkDstPath =[[NSString alloc]initWithBytes:&buf[0] length:len encoding:NSUTF8StringEncoding];
if(symlinkDstPath)
{
NSString *symlinkSrcPath = [[NSString alloc]initWithUTF8String:absolute_path.c_str()];
if(symlinkSrcPath)
{
is_symbolic_link = [fm createSymbolicLinkAtPath:symlinkSrcPath
withDestinationPath:symlinkDstPath error:nil];
[symlinkSrcPath release];
}
[symlinkDstPath release];
}

is_symbolic_link = true;
}

mz_zip_entry_close(h->zip_handle);
Expand Down
2 changes: 1 addition & 1 deletion zip/English.lproj/InfoPlist.strings
Original file line number Diff line number Diff line change
@@ -1 +1 @@
/* Localized versions of Info.plist keys */CFBundleName = "Zip";CFBundleShortVersionString = "3.2";CFBundleGetInfoString = "Zip version 3.2, Copyright 2019 miyako.";
/* Localized versions of Info.plist keys */CFBundleName = "Zip";CFBundleShortVersionString = "3.3";CFBundleGetInfoString = "Zip version 3.3, Copyright 2019 miyako.";
Expand Down
2 changes: 1 addition & 1 deletion zip/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<key>CFBundlePackageType</key>
<string>4DCB</string>
<key>CFBundleShortVersionString</key>
<string>3.2</string>
<string>3.3</string>
<key>CFBundleSignature</key>
<string>4D06</string>
<key>CSResourcesFileMapped</key>
Expand Down
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "4DPlugin-Zip.cpp"
timestampString = "589587246.650345"
timestampString = "589785038.533322"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "1469"
endingLineNumber = "1469"
startingLineNumber = "1470"
endingLineNumber = "1470"
landmarkName = "get_subpaths(absolute_path_t&amp; spath, relative_paths_t *relative_paths, absolute_paths_t *absolute_paths, bool ignore_dot, bool with_atttributes, bool without_enclosing_folder)"
landmarkType = "9">
</BreakpointContent>
Expand Down
Binary file modified zip/test/Data/data.4DD
Binary file not shown.
Empty file modified zip/test/Data/data.Match
100755 → 100644
Empty file.
Binary file modified zip/test/Data/data.journal
Binary file not shown.
2 changes: 1 addition & 1 deletion zip/test/Plugins/Zip.bundle/Contents/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<key>CFBundlePackageType</key>
<string>4DCB</string>
<key>CFBundleShortVersionString</key>
<string>3.2</string>
<string>3.3</string>
<key>CFBundleSignature</key>
<string>4D06</string>
<key>CFBundleSupportedPlatforms</key>
Expand Down
Binary file modified zip/test/Plugins/Zip.bundle/Contents/MacOS/Zip
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<dict>
<key>hash</key>
<data>
X3QgEbhqUKYDYjhCzTL1YCqrzGg=
IdwQtQ0m4j9R34gfkvahkr/YrfU=
</data>
<key>optional</key>
<true/>
Expand All @@ -35,11 +35,11 @@
<dict>
<key>hash</key>
<data>
X3QgEbhqUKYDYjhCzTL1YCqrzGg=
IdwQtQ0m4j9R34gfkvahkr/YrfU=
</data>
<key>hash2</key>
<data>
Ld9U+O0ZIv2me3YJBofOy97JXDT+29EmB9F/QvLuMJY=
gOuqTyR+e/BjqKljaw6t13fJHmqNGuOnleNAu702Kyg=
</data>
<key>optional</key>
<true/>
Expand Down
2 changes: 1 addition & 1 deletion zip/test/Project/DerivedData/methodAttributes.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"methods": {
"test_zip": {
"timeStamp": "2019-09-07T22:18:57.722Z"
"timeStamp": "2019-09-10T04:49:56.875Z"
},
"test_password": {
"timeStamp": "2019-08-30T06:50:59.000Z"
Expand Down
24 changes: 15 additions & 9 deletions zip/test/Project/Sources/Methods/test_zip.4dm
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,19 @@

$pass:="password"

$src:=System folder:C487(Applications or program files:K41:17)+"4D"+Folder separator:K24:12+"4D v17 R6"+Folder separator:K24:12+"4D.app"
$dst:=System folder:C487(Desktop:K41:16)+Current method name:C684+".zip"
If (False:C215)
$src:=System folder:C487(Desktop:K41:16)+"test"
$dst:=System folder:C487(Desktop:K41:16)+Current method name:C684+".zip"
$start:=Milliseconds:C459
$success:=Zip ($src;$dst;$pass;ZIP_Compression_level_2;ZIP_With_attributes)
$duration:=Milliseconds:C459-$start
Else
$src:=System folder:C487(Desktop:K41:16)+Current method name:C684+".zip"
$dst:=System folder:C487(Desktop:K41:16)
$start:=Milliseconds:C459
$success:=Unzip ($src;$dst;$pass;ZIP_With_attributes)
$duration:=Milliseconds:C459-$start
End if

$start:=Milliseconds:C459
$success:=Zip ($src;$dst;$pass;ZIP_Compression_level_2;ZIP_With_attributes)
$duration:=Milliseconds:C459-$start


$dst:=System folder:C487(Desktop:K41:16)+Current method name:C684+".7z"
$success:=Zip ($src;$dst;$pass;0;ZIP_7Z)
//$dst:=System folder(Desktop)+Current method name+".7z"
//$success:=Zip ($src;$dst;$pass;0;ZIP_7Z)
10 changes: 1 addition & 9 deletions zip/test/userPreferences.miyako/breakpoints.json
Original file line number Diff line number Diff line change
@@ -1,9 +1 @@
[
{
"line": 16,
"method": {
"type": 1,
"methodName": "test_zip"
}
}
]
[]
6 changes: 3 additions & 3 deletions zip/test/userPreferences.miyako/methodPreferences.json
Original file line number Diff line number Diff line change
Expand Up @@ -191,11 +191,11 @@
"Sources/Methods/test_zip.4dm": {
"startSelection": 0,
"endSelection": 0,
"firstSelectedLine": 10,
"lastSelectedLine": 10,
"firstSelectedLine": 5,
"lastSelectedLine": 5,
"folding": [],
"bookmarks": [],
"stamp": "2019-09-07T22:18:57.722Z"
"stamp": "2019-09-10T04:49:56.875Z"
},
"Sources/Methods/test_password.4dm": {
"startSelection": 40,
Expand Down
4 changes: 2 additions & 2 deletions zip/test/userPreferences.miyako/methodWindowPositions.json
Original file line number Diff line number Diff line change
Expand Up @@ -156,8 +156,8 @@
"height": 662
},
"Sources/Methods/test_zip.4dm": {
"left": 55,
"top": 193,
"left": 4,
"top": 191,
"width": 1186,
"height": 764
},
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?><preferences stamp="142">
<?xml version="1.0" encoding="UTF-8"?><preferences stamp="146">
<com.4d>
<database>
<data_storage data_path=":Data:data.4DD"/>
Expand Down

0 comments on commit e57f827

Please sign in to comment.