com.springrts.ai.oo
Class DataDirs

java.lang.Object
  extended by com.springrts.ai.oo.DataDirs
All Implemented Interfaces:
Comparable<DataDirs>

public class DataDirs
extends Object
implements Comparable<DataDirs>


Method Summary
 String allocatePath(String relPath, boolean writeable, boolean create, boolean dir, boolean common)
           
 int compareTo(DataDirs other)
           
 boolean equals(Object otherObject)
           
 String getConfigDir()
          This interfaces main data dir, which is where the shared library and the InterfaceInfo.lua file are located, e.g.: /usr/share/games/spring/AI/Skirmish/RAI/0.601/
 byte getPathSeparator()
          Returns '/' on posix and '\\' on windows
 Roots getRoots()
           
 String getWriteableDir()
          This interfaces writeable data dir, which is where eg logs, caches and learning data should be stored, e.g.: /home/userX/.spring/AI/Skirmish/RAI/0.601/
 int hashCode()
           
 boolean locatePath(String path, int path_sizeMax, String relPath, boolean writeable, boolean create, boolean dir, boolean common)
          Returns an absolute path which consists of: data-dir + Skirmish-AI-path + relative-path.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Method Detail

compareTo

public int compareTo(DataDirs other)
Specified by:
compareTo in interface Comparable<DataDirs>

equals

public boolean equals(Object otherObject)
Overrides:
equals in class Object

hashCode

public int hashCode()
Overrides:
hashCode in class Object

toString

public String toString()
Overrides:
toString in class Object

getPathSeparator

public byte getPathSeparator()
Returns '/' on posix and '\\' on windows


getConfigDir

public String getConfigDir()
This interfaces main data dir, which is where the shared library and the InterfaceInfo.lua file are located, e.g.: /usr/share/games/spring/AI/Skirmish/RAI/0.601/


getWriteableDir

public String getWriteableDir()
This interfaces writeable data dir, which is where eg logs, caches and learning data should be stored, e.g.: /home/userX/.spring/AI/Skirmish/RAI/0.601/


locatePath

public boolean locatePath(String path,
                          int path_sizeMax,
                          String relPath,
                          boolean writeable,
                          boolean create,
                          boolean dir,
                          boolean common)
Returns an absolute path which consists of: data-dir + Skirmish-AI-path + relative-path. example: input: "log/main.log", writeable, create, !dir, !common output: "/home/userX/.spring/AI/Skirmish/RAI/0.601/log/main.log" The path "/home/userX/.spring/AI/Skirmish/RAI/0.601/log/" is created, if it does not yet exist.

Parameters:
path - store for the resulting absolute path
path_sizeMax - storage size of the above
writeable - if true, only the writeable data-dir is considered
create - if true, and realPath is not found, its dir structure is created recursively under the writeable data-dir
dir - if true, realPath specifies a dir, which means if create is true, the whole path will be created, including the last part
common - if true, the version independent data-dir is formed, which uses "common" instead of the version, eg: "/home/userX/.spring/AI/Skirmish/RAI/common/..."
Returns:
whether the locating process was successfull -> the path exists and is stored in an absolute form in path
See Also:
DataDirs_Roots_locatePath

allocatePath

public String allocatePath(String relPath,
                           boolean writeable,
                           boolean create,
                           boolean dir,
                           boolean common)
See Also:
locatePath()

getRoots

public Roots getRoots()