Jermey,
follows code that should resolve your conversion to posix

  //fileutl_Path_Convert_to_Posix
  //$1 - Text - Path to convert

  //Original from JorgeChB via iNug

  //Converts a Mac file path to a Posix form

  //RETURNS - Text - converted path, or empty string if path is empty, 
or error
  // • Created 3/24/15 by Chip - 
  //• Updated 05-17-18 by Chip - added test for empty path
C_TEXT($Path;$Path;$0;$msg)


If (Count parameters>=1)
$Path:=$1

Case of 
: ($Path="")
$msg:="Source Path is empty"
ALERT($msg)

: (Position(Colon_Char;$Path)>0)
$Path:=Replace string($Path;Slash_Char;"__-sLaSh-__")  //'a/b' -> 
'a__-sLaSh-__b'
$Path:=Replace string($Path;Colon_Char;Slash_Char)  //'a:b' -> 'a/b'
$Path:=Replace string($Path;"__-sLaSh-__";Colon_Char)  
//'a__-sLaSh-__b' -> 'a:b'
$Path:=Replace 
string($Path;BackSlash_Char;BackSlash_Char+BackSlash_Char)  //'a\\b' -> 
'a\\b'"
$Path:=Replace string($Path;Space_Char;BackSlash_Char+Space_Char)  //'a 
b' -> 'a\ b'
$Path:=Replace string($Path;"*";BackSlash_Char+"*")  //'a*b' -> 'a\*b'
$Path:=Replace string($Path;"'";BackSlash_Char+"'")  //'a'b' -> 'a\'b'
$Path:=Replace string($Path;"&";BackSlash_Char+"&")  //'a&b' -> 'a\&b'
$Path:=Replace string($Path;Quote_Char;BackSlash_Char+Quote_Char)  
//'a"b' -> 'a\"b'
$Path:=Replace string($Path;"(";BackSlash_Char+"(")  //'a(b' -> 'a\(b'
$Path:=Replace string($Path;")";BackSlash_Char+")")  //'a)b' -> 'a\)b'

  //make sure we do not prepend 'Volumes' if it already there
If (Position("/Volumes/";$Path)=0)
$0:="/Volumes/"+$Path
Else 
$0:=$Path
End if 
Else 
$msg:="Posix conversion is only applicable "
$msg:=$msg+"to paths formatted for use on a Macintosh."
ALERT($msg)
End case 
Else 
$msg:="Required parameters (1) not passed."+Cr_Char
$msg:=$msg+"Parameters passed "+String(Count parameters)
ALERT($msg)
End if 
  //End fileutl_Path_Convert_to_Posix  

On Mon, 24 Jun 2019 10:57:14 -0400, Jeremy French via 4D_Tech wrote:
> How do we resolve POSIX file path syntax between 4D and Mac Terminal?
> 
> This Mac system path has a space in the folder name "Final Application":
> Macintosh 
> HD:Users:jeremyfrench:Desktop:test_notarize_01:test_notarize_01_Build:Final 
> Application:test_notarize_01.app:
> 
> 4D's POSIX shows the space in "Final Application" unescaped:
> /Users/jeremyfrench/Desktop/test_notarize_01/test_notarize_01_Build/Final 
> Application/test_notarize_01.app/
> 
> And 4D's escaped POSIX shows the space represented as "%20”, like this:
> 
/Users/jeremyfrench/Desktop/test_notarize_01/test_notarize_01_Build/Final%20Application/test_notarize_01.app/
> 
> Neither 4D syntax (escaped or unescaped) matches Terminal's POSIX syntax.
> 
> Terminal's POSIX shows the space in "Final Application" escaped 
> differently, with a left-slash: "\ "
> /Users/jeremyfrench/Desktop/test_notarize_01/test_notarize_01_Build/Final\ 
> Application/test_notarize_01.app
> 
> QUESTIONS:
> 
> Does Terminal escape only space characters?
> Are there other characters that Terminal escapes with a left-slash?
> Is replacing a space with left-slash-space the only change needed to 
> convert 4D's POSIX to Terminal's POXSIX?
> **********************************************************************
> 4D Internet Users Group (4D iNUG)
> Archive:  http://lists.4d.com/archives.html
> Options: https://lists.4d.com/mailman/options/4d_tech
> Unsub:  mailto:[email protected]
> **********************************************************************
---------------
Gas is for washing parts
Alcohol is for drinkin'
Nitromethane is for racing 
**********************************************************************
4D Internet Users Group (4D iNUG)
Archive:  http://lists.4d.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:[email protected]
**********************************************************************

Reply via email to