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

Clib Change Directory Method


The Clib Change Directory method modifies the current directory for the Siebel application. It returns one of the following values:

  • If successful, then it returns the following value:

    0

  • If not successful, then it returns the following value:

    Negative 1

If you restart the Siebel Server, then Siebel CRM automatically resets the current directory depending on one of the following operating systems that you use:

  • Windows. The current directory on the Siebel Server that the Windows operating system recognizes.
  • UNIX. The home directory of the administrator who restarts the Siebel Server.
Format

Clib.chdir(dirPath)

Table 131 describes the arguments for the Clib Change Directory method.

Table 131. Arguments for the Clib Change Directory Method
Argument
Description

dirpath

The directory path that this method makes current. This path can be absolute or relative.

Example

The following example uses the Clib Change Directory method to change the current working directory of the Siebel application. The default Siebel working directory is SIEBEL_ROOT\bin. For example, if you install the Siebel client in the C:\sea81\client directory, then the default working directory is C:\sea81\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;
   // 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 gives an
   // error
   Clib.rmdir("Clib test");
   msg = Clib.chdir("C:\\Clib test");
   TheApplication().Trace(msg);
}

This example produces the following result:

Current directory is D:\sea81\client\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.