| AngelScript |

All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
filesystem object

Path: /sdk/add_on/scriptfile/

This object provides support for inspecting directories on the filesystem.

Register with `RegisterScriptFileSystem(asIScriptEngine*)`.

# Public C++ interface

class CScriptFileSystem
{
public:
CScriptFileSystem();
void AddRef() const;
void Release() const;
// Sets the current path that should be used in other calls when using relative paths
// It can use relative paths too, so moving up a directory is used by passing in ".."
bool ChangeCurrentPath(const std::string &path);
std::string GetCurrentPath() const;
// Returns true if the path is a directory. Input can be either a full path or a relative path
bool IsDir(const std::string &path) const;
// Returns a list of the files in the current path
CScriptArray *GetFiles() const;
// Returns a list of the directories in the current path
CScriptArray *GetDirs() const;
};

# Public script interface

      class filesystem
      {
        bool           changeCurrentPath(const string &in);
        string         getCurrentPath() const;
        array<string> @getDirs();
        array<string> @getFiles();
        bool           isDir(const string &in);
      }

bool changeCurrentPath(const string &in path)

This changes the current directory used by the filesystem object. It will return true if the given path is valid.

It doesn't change the application' working directory.

string getCurrentPath() const

Returns the current path used by the filesystem object.

array<string> @getDirs()

Returns a list with the names of all directories in the current path.

array<string> @getFiles()

Returns a list with the names of all files in the current path.

bool isDir(const string &in path)

Returns true if the given path is a directory.