fsDirCurrent (Function)

Top  Previous  Next

Architecture:

X32 / NX32 / NX32L

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 from index 0
   i := 0;
   REPEAT
      str := fsDirCatalog(index := i);
      IF strLen(str := str) > 0 THEN
         DebugMsg(message := str);
        i := i + 1;
      END_IF;
   UNTIL strLen(str := str) = 0
   END_REPEAT;
   // If no entry was found, print it
   IF i = 0 THEN
      DebugMsg(message := "<EMPTY>");
   END_IF;
END_FUNCTION;