Wanzyee Studio

Include some convenient methods to extend IO operation. More...

Static Public Member Functions

static string[] GetDeepFiles (params string[] paths)
 Filter to get the paths of all files and files in directories except "*.meta". More...
 
static void Delete (string path, bool ancestor=false)
 Try to delete a file or directory at the specified path. More...
 
static bool CheckCreatable (string path, bool exception=false)
 Determine if the path can be used to create a file or directory. More...
 

Detailed Description

Include some convenient methods to extend IO operation.

3

Member Function Documentation

static string [] GetDeepFiles ( params string[]  paths)
static

Filter to get the paths of all files and files in directories except "*.meta".

Parameters
pathsPaths.
Returns
The file paths.
static void Delete ( string  path,
bool  ancestor = false 
)
static

Try to delete a file or directory at the specified path.

This doesn't work in Web Player. Note, the operation is permanently and irreversibly. Optional to trace and delete ancestor directories if became empty.

Parameters
pathPath.
ancestorIf set to true delete ancestor directories if empty.
static bool CheckCreatable ( string  path,
bool  exception = false 
)
static

Determine if the path can be used to create a file or directory.

A legal path might not be in good format, e.g., "C:dir\ //file" or "/\pc\share\\new.txt". But it's safe to pass to Directory or FileInfo to create.

Path in situations below is invalid, even dangerous:

  1. Nothing but empty or white-spaces, nowhere to go.
  2. Starts with 3 slashes, this causes crash while system looking for parent directories.
  3. Includes invalid chars, can't name a file.
  4. A name in path starts or ends with space, we can't get the created file, even delete.
Parameters
pathPath.
exceptionIf invalid, throw an exception or return false.
Returns
true if is creatable; otherwise, false.