Siebel eScript Language Reference > Siebel eScript Commands > File I/O Methods in eScript >

Clib.getcwd() Method


This method returns the entire path of the current working directory for a script.

Syntax

Clib.getcwd()

Returns

The entire path of the current working directory for a script.

Usage

In a Siebel application, the default current working directory is the directory in which the application has been installed. If a script changes the current working directory (using Clib.chdir() or similar command), the current working directory returns to its original value when the script finishes.

Example

In this example, the current directory is displayed in a message box. The script then makes the root the current directory, creates a new directory, removes that directory, and then attempts to make the removed directory current.

function Button_Click ()

{

   var currDir = Clib.getcwd();
   TheApplication().Trace("Current directory is " + Clib.getcwd());
   var msg = Clib.mkdir('C:\\Clib test');
   // Display the error flag created by creating directory;   
   // Should be 0, indicating no error.
   TheApplication().Trace(msg);
   // Change the current directory to the new 'Clib test'
   Clib.chdir("C:\\Clib test");
   TheApplication().Trace("Current directory is " + Clib.getcwd());
   // Delete 'Clib test'
   Clib.chdir("C:\\");
   // Attempting to make a removed directory current yields error
       flag
   Clib.rmdir("Clib test");
   msg = Clib.chdir("C:\\Clib.test");
   TheApplication().Trace(msg);
}

The output displayed in the message boxes is as follows:

Current directory is C:\SIEBEL\BIN
0
Current directory is C:\Clib test
-1

See Also

Clib.clearerr() Method
Clib.mkdir() Method
Clib.rmdir() Method

Siebel eScript Language Reference