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
|
else
|
||||||
xdg-open "$url"
|
xdg-open "$url"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
exit
|
exit
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
setOs()
|
setOs()
|
||||||
|
@ -98,13 +101,19 @@ sendFiles()
|
||||||
[[ -a "$zipPath" ]] && echo "Cannot overwrite $zipPath. Please remove first." && exit
|
[[ -a "$zipPath" ]] && echo "Cannot overwrite $zipPath. Please remove first." && exit
|
||||||
|
|
||||||
if [[ -d $path ]]; then
|
if [[ -d $path ]]; then
|
||||||
zipPathTemp="temp_${zipPath}"
|
zipPathTemp="${path}_pairdrop_temp.zip"
|
||||||
[[ -a "$zipPathTemp" ]] && echo "Cannot overwrite $zipPathTemp. Please remove first." && exit
|
[[ -a "$zipPathTemp" ]] && echo "Cannot overwrite $zipPathTemp. Please remove first." && exit
|
||||||
echo "Processing directory..."
|
echo "Processing directory..."
|
||||||
|
|
||||||
# Create zip files temporarily to send directory
|
# Create zip files temporarily to send directory
|
||||||
zip -q -b /tmp/ -r "$zipPath" "$path"
|
if [[ $OS == "Windows" ]];then
|
||||||
zip -q -b /tmp/ "$zipPathTemp" "$zipPath"
|
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
|
if [[ $OS == "Mac" ]];then
|
||||||
hash=$(base64 -i "$zipPathTemp")
|
hash=$(base64 -i "$zipPathTemp")
|
||||||
|
@ -118,8 +127,12 @@ sendFiles()
|
||||||
echo "Processing file..."
|
echo "Processing file..."
|
||||||
|
|
||||||
# Create zip file temporarily to send 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
|
if [[ $OS == "Mac" ]];then
|
||||||
hash=$(base64 -i "$zipPath")
|
hash=$(base64 -i "$zipPath")
|
||||||
else
|
else
|
||||||
|
@ -142,6 +155,7 @@ sendFiles()
|
||||||
hash=
|
hash=
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
openPairDrop
|
openPairDrop
|
||||||
exit
|
exit
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue