fsDirCurrent (Function)

Top  Previous  Next

Architecture:

X32 / NX32 / NX32L

Device support:

All

Firmware version:

1.00 / 1.00.00


This returns the absolute path to the current working directory of the calling thread - including the media.

 

 

Input:

None.

 

Returns: STRING

The current directory or empty if an error occurred (media is not open or has been removed without closing it).

 

Declaration:

FUNCTION fsDirCurrent : STRING;

 

 

Example:

INCLUDE rtcu.inc
 
FUNCTION directory_dump;
VAR
  i   : INT;
  str : STRING;
END_VAR;
  // Print current directory
  DebugMsg(message := "Directory: " + fsDirCurrent());
  // Iterate directory
  REPEAT
     str := fsDirCatalog(index := i);
    IF strLen(str := str) > 0 THEN
        DebugMsg(message := str);
    END_IF;
     i := i + 1;
  UNTIL strLen(str := str) = 0
  END_REPEAT;
  // If directory is empty, print it
  IF i = 1 THEN
    DebugMsg(message := "<EMPTY>");
  END_IF;
END_FUNCTION;