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

Clib.chdir() Method


This method changes the current directory for the Siebel application.

Syntax

Clib.chdir(dirPath)

Parameter
Description

dirpath

The path to the directory to make current. The path can be absolute or relative.

Returns

0 if successful; otherwise, -1.

Usage

This method changes the current directory for the Siebel application. If the Siebel Server is restarted, the current directory is automatically reset as one of the following:

  • The current directory recognized by the Windows operating system on the Siebel Server
  • The home directory of the administrator who restarts the Siebel Server on UNIX
Example

The following example shows the use of Clib.chdir() to change the current working directory of the Siebel application. The default Siebel working directory is the Siebel Root\bin directory. For example, if you installed the Siebel client in C:\sea752\client, then the default working directory is C:\sea752\client\bin.

function Application_Start (CommandLine)
{

   // Start Tracing
   TheApplication().TraceOn("c:\\temp\\SiebTrace.txt","Allocation","All");

   var currDir = Clib.getcwd();
   TheApplication().Trace("Current directory is " + Clib.getcwd());

   // Create a new directory
   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 gives an
   // error
   Clib.rmdir("Clib test");
   msg = Clib.chdir("C:\\Clib test");
   TheApplication().Trace(msg);
}

Here are the trace results from the script:

Current directory is D:\sea752\client\BIN
0
Current directory is C:\Clib test
-1

See Also

Clib.getenv() Method
Clib.mkdir() Method
Clib.rmdir() Method

Siebel eScript Language Reference