WD Handling directories
// Displays the current directory
Info("Current directory: "+fCurrentDir())
EDT_CURRENTDIR = fCurrentDir()
//-------------------------------------------------------------------
Fsep() = / ou \
//-------------------------------------------------------------------
// Displays the directory of the application
Info("Application Directory: "+fExeDir())
// Display the runtime directory
EDT_APPLICATIONDIR = fExeDir()
//--------------------------------------------------------------------
// Create the TEMPTEST directory
Creation_directory(gsDir1)
//--------------------------------------------------------------------
// Create the TEMPTEST1, TEMPTEST2, TEMPTEST3 directory
Creation_directory(gsDir3)
Creation_directory(gsDir4)
Creation_directory(gsDir5)
//---------------------------------------------------------------------
// Summary: Create a directory at the location specified by gsName
// Syntax:
// Create_directory ()
//
// Parameters:
// gsName: name of the directory to create
// Return value:
// None
//
// Example:
// Indicate an example.
//
PROCEDURE Creation_directory(gsName is string)
IF fDirectoryExist(gsName) = False THEN
// Directory not found
IF NOT fMakeDir(gsName) THEN
Error(StringBuild("Error dreating directory %1",gsName))
ELSE
Info(StringBuild("%1 directory successfully created",gsName))
DIR_DEL..State = Active
END
ELSE
// Directory found
Error(StringBuild("The %1 directory already exists",gsName))
DIR_DEL..State = Active
END
//---------------------------------------------------------------------------------
// Check the validity of gsDir1.
IF fDirectoryExist(gsDir1) = False THEN
Error("Invalid directory")
END
//clear the list
ListDeleteAll(LISTDIR)
ADirectory, ResListDirectory are strings
// Lists all the directories found in gsDir1, recursively.
ResListDirectory = fListDirectory(gsDir1,frRecursive)
// For each directory found
FOR EACH STRING ADirectory OF ResListDirectory SÉPARÉE BY CR
// Add the directory into the list
ListAdd(LISTDIR,ADirectory)
END
//-----------------------------------------------------------------------------
sRes is string = "" // Name of the selected directory
// Using the Windows directory picker
sRes = fSelectDir(CompleteDir(EDT_CURRENTDIR), "Select a directory...", "")
// Was the selection of a directory validated the user
IF sRes <> "" THEN
// A directory was selected by the user
Info(StringBuild("The directory selected is %1", sRes))
ELSE
// No directory was selected by the user
Info("No selected directory")
END
//------------------------------------------------------------------------------
// Displays the directory of the application
Info("Name of directory for the user data: "+fDataDirUser())
// Display the runtime directory
EDT_APPLICATIONDIR = fExeDir()
//-------------------------------------------------------------------------------