Tech Tip: Utility method to return the path the data file on the server
PRODUCT: 4D Server | VERSION: 12.3 | PLATFORM: Mac & Win
Published On: March 23, 2012
The method below OnServer_Get_4DD_Folder is handy for those occassions where the data file and structure file are stored in separate folders on the server.
There are a number of files 4D stores in the same folder with the data file and there is no constant to the command Get 4D Folder to return the pathName to the folder containing the 4D data file.
If (True) If (False) Begin SQL /* OnServer_Get_4DD_Folder Purpose: Return the path to folder on the server machine containing the {databasName}.4DD file $0 - TEXT string Method Properties: Invisible / Execute on Server */ End SQL End if C_TEXT($MethodName_T) $MethodName_T:=Current method name //=============== Declare Variables =============== //local_variable_declarations C_LONGINT($Ndx) C_TEXT($4DDPath_T) End if //=============== Initialize and Setup =============== // There's no constant to "Get 4D folder" // that returns the path to the data file // ( $4DDPath_T:=Data file $Ndx:=Length($4DDPath_T) // ) //=============== Method Actions =============== // From the end of the string, find the ending folder separator // ( If ($Ndx>0) While ($4DDPath_T≤$Ndx≥#Folder separator) $Ndx:=$Ndx-1 End while End if // ) //=============== Clean up and Exit =============== // Return the path to the // ( If ($Ndx>0) $0:=Substring($4DDPath_T;1;$Ndx) End if // ) |