Siebel eScript Language Reference > C Language Library Reference > Clib File and Directory Methods >

Clib Get Current Working Directory Method


The Clib Get Current Working Directory method returns the entire path of the current working directory. The default current working directory is the directory where you install the Siebel application.

If a script uses the Clib Change Directory method or a similar method to change the current working directory, then the current working directory returns to the original value after the script finishes.

Format

Clib.getcwd()

Example

The following example displays the current directory in a message box. The script then makes the root directory 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;   
   // Must 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);
}

This example displays the following output:

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

Siebel eScript Language Reference Copyright © 2013, Oracle and/or its affiliates. All rights reserved. Legal Notices.