mirror of
https://github.com/schlagmichdoch/PairDrop.git
synced 2025-04-21 23:36:17 -04:00
Merge pull request #137 from Zhongbing-Chen/master
revise the command line tool
This commit is contained in:
commit
d9686a6706
1 changed files with 18 additions and 4 deletions
|
@ -38,7 +38,10 @@ openPairDrop()
|
|||
else
|
||||
xdg-open "$url"
|
||||
fi
|
||||
|
||||
|
||||
exit
|
||||
|
||||
}
|
||||
|
||||
setOs()
|
||||
|
@ -98,13 +101,19 @@ sendFiles()
|
|||
[[ -a "$zipPath" ]] && echo "Cannot overwrite $zipPath. Please remove first." && exit
|
||||
|
||||
if [[ -d $path ]]; then
|
||||
zipPathTemp="temp_${zipPath}"
|
||||
zipPathTemp="${path}_pairdrop_temp.zip"
|
||||
[[ -a "$zipPathTemp" ]] && echo "Cannot overwrite $zipPathTemp. Please remove first." && exit
|
||||
echo "Processing directory..."
|
||||
|
||||
# Create zip files temporarily to send directory
|
||||
zip -q -b /tmp/ -r "$zipPath" "$path"
|
||||
zip -q -b /tmp/ "$zipPathTemp" "$zipPath"
|
||||
if [[ $OS == "Windows" ]];then
|
||||
powershell.exe -Command "Compress-Archive -Path ${path} -DestinationPath ${zipPath}"
|
||||
echo "Compress-Archive -Path ${zipPath} -DestinationPath ${zipPathTemp}"
|
||||
powershell.exe -Command "Compress-Archive -Path ${zipPath} -DestinationPath ${zipPathTemp}"
|
||||
else
|
||||
zip -q -b /tmp/ -r "$zipPath" "$path"
|
||||
zip -q -b /tmp/ "$zipPathTemp" "$zipPath"
|
||||
fi
|
||||
|
||||
if [[ $OS == "Mac" ]];then
|
||||
hash=$(base64 -i "$zipPathTemp")
|
||||
|
@ -118,8 +127,12 @@ sendFiles()
|
|||
echo "Processing file..."
|
||||
|
||||
# Create zip file temporarily to send file
|
||||
zip -q -b /tmp/ "$zipPath" "$path"
|
||||
|
||||
if [[ $OS == "Windows" ]];then
|
||||
powershell.exe -Command "Compress-Archive -Path ${path} -DestinationPath ${zipPath} -CompressionLevel Optimal"
|
||||
else
|
||||
zip -q -b /tmp/ "$zipPath" "$path"
|
||||
fi
|
||||
if [[ $OS == "Mac" ]];then
|
||||
hash=$(base64 -i "$zipPath")
|
||||
else
|
||||
|
@ -142,6 +155,7 @@ sendFiles()
|
|||
hash=
|
||||
fi
|
||||
|
||||
|
||||
openPairDrop
|
||||
exit
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue