Skip to content

Commit 08ca012

Browse files
committed
FR request: use automatic double quotes for Dropbox #6
1 parent d6fee9d commit 08ca012

1 file changed

Lines changed: 14 additions & 8 deletions

File tree

Project/Sources/Classes/FileTransfer_Dropbox.4dm

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ Function upload($sourcepath : Text; $targetpath : Text)->$success : Object
4848
ASSERT:C1129(Length:C16($sourcepath)>0; "source path must not be empty")
4949
ASSERT:C1129(Length:C16($targetpath)>0; "target path must not be empty")
5050

51-
$url:="put "+$sourcepath+" "+$targetpath
51+
$url:="put "+This:C1470._doublequotes($sourcepath)+" "+This:C1470._doublequotes($targetpath)
5252
$oldtimeout:=This:C1470._timeout
5353
If ($oldtimeout=0)
5454
This:C1470._timeout:=600
@@ -65,7 +65,7 @@ Function download($sourcepath : Text; $targetpath : Text)->$success : Object
6565
ASSERT:C1129(Length:C16($sourcepath)>0; "source path must not be empty")
6666
ASSERT:C1129(Length:C16($targetpath)>0; "target path must not be empty")
6767

68-
$url:="get "+$sourcepath+" "+$targetpath
68+
$url:="get "+This:C1470._doublequotes($sourcepath)+" "+This:C1470._doublequotes($targetpath)
6969
$oldtimeout:=This:C1470._timeout
7070
If ($oldtimeout=0)
7171
This:C1470._timeout:=600
@@ -75,23 +75,23 @@ Function download($sourcepath : Text; $targetpath : Text)->$success : Object
7575

7676
Function createDirectory($targetpath : Text) : Object
7777
ASSERT:C1129(Length:C16($targetpath)>0; "target path must not be empty")
78-
return This:C1470._runWorker("mkdir "+$targetpath)
78+
return This:C1470._runWorker("mkdir "+This:C1470._doublequotes($targetpath))
7979

8080
Function deleteDirectory($targetpath : Text; $force : Boolean) : Object
8181
var $url : Text
8282

8383
ASSERT:C1129(Length:C16($targetpath)>0; "target path must not be empty")
8484
If ($force)
85-
$url:="rm -f "+$targetpath
85+
$url:="rm -f "+This:C1470._doublequotes($targetpath)
8686
Else
87-
$url:="rm "+$targetpath
87+
$url:="rm "+This:C1470._doublequotes($targetpath)
8888
End if
8989
return This:C1470._runWorker($url)
9090

9191
Function deleteFile($targetpath : Text) : Object
9292
// same as deleteDirectory
9393
ASSERT:C1129(Length:C16($targetpath)>0; "target path must not be empty")
94-
return This:C1470._runWorker("rm "+$targetpath)
94+
return This:C1470._runWorker("rm "+This:C1470._doublequotes($targetpath))
9595

9696
Function renameFile($sourcepath : Text; $targetpath : Text) : Object
9797
var $url : Text
@@ -109,7 +109,7 @@ Function copyFile($sourcepath : Text; $targetpath : Text) : Object
109109

110110
ASSERT:C1129(Length:C16($sourcepath)>0; "source path must not be empty")
111111
ASSERT:C1129(Length:C16($targetpath)>0; "target path must not be empty")
112-
$url:="cp "+$sourcepath+" "+$targetpath
112+
$url:="cp "+This:C1470._doublequotes($sourcepath)+" "+This:C1470._doublequotes($targetpath)
113113
return This:C1470._runWorker($url)
114114

115115
Function executeCommand($command : Text)->$success : Object
@@ -250,4 +250,10 @@ Function _trim($text : Text)->$result : Text
250250
While (Substring:C12($result; Length:C16($result); 1)=" ")
251251
$result:=Substring:C12($result; 1; Length:C16($result)-1)
252252
End while
253-
253+
254+
Function _doublequotes($text : Text)->$result : Text
255+
If (Position:C15(Char:C90(Double quote:K15:41); $text; *)<0)
256+
$result:=Char:C90(Double quote:K15:41)+$text+Char:C90(Double quote:K15:41)
257+
Else
258+
$result:=$text
259+
End if

0 commit comments

Comments
 (0)