Skip to content

Commit 3b6e4b6

Browse files
committed
append _file_system_path_to_object($path : Text) : Object evaluate path like /PACKAGE inside host database
1 parent e066b68 commit 3b6e4b6

File tree

2 files changed

+93
-27
lines changed

2 files changed

+93
-27
lines changed

Build4D/Project/Sources/Classes/Server.4dm

Lines changed: 18 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -923,22 +923,17 @@ Function build() : Boolean
923923

924924
// ACI0105675 update
925925

926-
var $formula : 4D.Function
927-
var $cmd : Text
926+
var $archive : Object
928927

929-
Case of
930-
931-
: (Value type(This.settings.macOSClientArchive)=Is text) && (Position(Folder separator; This.settings.macOSClientArchive)>0) && (Test path name(This.settings.macOSClientArchive)=Is a document)
932-
This.settings.macOSClientArchive:=File(This.settings.macOSClientArchive; fk platform path)
933-
934-
: (Value type(This.settings.macOSClientArchive)=Is text) && (Position("/"; This.settings.macOSClientArchive)=1)
935-
$cmd:="File:C1566(\""+This.settings.macOSClientArchive+"\").platformPath"
936-
$formula:=Formula from string($cmd; sk execute in host database)
937-
This.settings.macOSClientArchive:=File($formula.call(); fk platform path)
938-
939-
End case
940928

941-
If (OB Instance of(This.settings.macOSClientArchive; 4D.File) && (This.settings.macOSClientArchive.exists)) //#2062
929+
If (Value type(This.settings.macOSClientArchive)=Is text)
930+
931+
$archive:=This._file_system_path_to_object(This.settings.macOSClientArchive)
932+
This.settings.macOSClientArchive:=$archive.file
933+
934+
End if
935+
936+
If (OB Instance of(This.settings.macOSClientArchive; 4D.File) && This.settings.macOSClientArchive.exists) //#2062
942937

943938
This.settings.macOSClientArchive.copyTo($Upgrade4DClient)
944939

@@ -948,20 +943,17 @@ Function build() : Boolean
948943

949944
// ACI0105675 update
950945

951-
Case of
952-
953-
: (Value type(This.settings.windowsClientArchive)=Is text) && (Position(Folder separator; This.settings.windowsClientArchive)>0) && (Test path name(This.settings.windowsClientArchive)=Is a document)
954-
This.settings.windowsClientArchive:=File(This.settings.windowsClientArchive; fk platform path)
955-
956-
: (Value type(This.settings.windowsClientArchive)=Is text) && (Position("/"; This.settings.windowsClientArchive)=1)
957-
$cmd:="File:C1566(\""+This.settings.windowsClientArchive+"\").platformPath"
958-
$formula:=Formula from string($cmd; sk execute in host database)
959-
This.settings.windowsClientArchive:=File($formula.call(); fk platform path)
960-
961-
End case
946+
947+
If (Value type(This.settings.windowsClientArchive)=Is text)
948+
949+
$archive:=This._file_system_path_to_object(This.settings.windowsClientArchive)
950+
This.settings.windowsClientArchive:=$archive.file
951+
952+
End if
953+
962954

963955

964-
If (OB Instance of(This.settings.windowsClientArchive; 4D.File) && (This.settings.windowsClientArchive.exists)) //#2063
956+
If (OB Instance of(This.settings.windowsClientArchive; 4D.File) && This.settings.windowsClientArchive.exists) //#2063
965957

966958
This.settings.windowsClientArchive.copyTo($Upgrade4DClient)
967959

Build4D/Project/Sources/Classes/_core.4dm

Lines changed: 75 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -769,6 +769,7 @@ Function _create4DZ() : Boolean
769769
$zipStructure:=New object
770770
$zipStructure.files:=New collection($structureFolder.folder("Project"))
771771
$zipStructure.encryption:=(This.settings.obfuscated) ? -1 : ZIP Encryption none
772+
772773
$return:=ZIP Create archive($zipStructure; $structureFolder.file(This.settings.buildName+".4DZ"))
773774

774775
If ($return.success)
@@ -1509,4 +1510,77 @@ Function _is_xml_reference($reference : Text) : Boolean
15091510

15101511
return False
15111512

1512-
End try
1513+
End try
1514+
1515+
1516+
1517+
1518+
1519+
Function _file_system_path_to_object($path : Text) : Object
1520+
var $formula : 4D.Function
1521+
var $cmd : Text
1522+
var $result : Object
1523+
1524+
1525+
Try
1526+
1527+
$cmd:="Path to object:C1547(\""+$path+"\")"
1528+
1529+
$formula:=Formula from string($cmd; sk execute in host database)
1530+
1531+
// test path type file or folder
1532+
$result:=$formula.call()
1533+
1534+
1535+
// evaluate the plateformPath
1536+
If ($result.isFolder)
1537+
$cmd:="Folder:C1567(\""+Object to path($result)+"\").platformPath"
1538+
$formula:=Formula from string($cmd; sk execute in host database)
1539+
$result.platformPath:=$formula.call()
1540+
Else
1541+
$cmd:="File:C1566(\""+Object to path($result)+"\").platformPath"
1542+
$formula:=Formula from string($cmd; sk execute in host database)
1543+
$result.platformPath:=$formula.call()
1544+
End if
1545+
1546+
1547+
//convert the full path to object
1548+
$cmd:="Path to object:C1547(\""+$result.platformPath+"\")"
1549+
$formula:=Formula from string($cmd; sk execute in host database)
1550+
$result:=$formula.call()
1551+
1552+
1553+
//append the full platform path
1554+
$result.platformPath:=Object to path($result)
1555+
1556+
$result.isFile:=Not($result.isFolder)
1557+
1558+
//associate file or folder instance
1559+
//correct posix path
1560+
//correct parent folder
1561+
If ($result.isFolder)
1562+
$result.folder:=Folder($result.platformPath; fk platform path)
1563+
$result.path:=$result.folder.path
1564+
$result.parentFolder:=$result.folder.parent
1565+
Else
1566+
$result.file:=File($result.platformPath; fk platform path)
1567+
$result.path:=$result.file.path
1568+
$result.parentFolder:=$result.file.parent
1569+
End if
1570+
1571+
Catch
1572+
1573+
$result.errors:=Last errors
1574+
1575+
End try
1576+
1577+
$result:=$result || {isFolder: False; isFile: False}
1578+
1579+
return $result
1580+
1581+
1582+
1583+
1584+
1585+
1586+

0 commit comments

Comments
 (0)