JX Application Framework
|
#include "jDirUtil.h"
#include "JThisProcess.h"
#include "JDirInfo.h"
#include "JProgressDisplay.h"
#include "JLatentPG.h"
#include "JSimpleProcess.h"
#include "JStringIterator.h"
#include "jGlobals.h"
#include "JStdError.h"
#include <pwd.h>
#include "jErrno.h"
#include "jMissingProto.h"
#include "jAssert.h"
Returns true if it is possible to make the specified directory the working directory.
Changes the current working directory to the specified directory.
Can return JAccessDenied, JSegFault, JNameTooLong, JBadPath, JNoKernelMemory, JComponentNotDirectory, JPathContainsLoop.
void JCleanPath | ( | JString * | path | ) |
Removes fluff from the given path:
/./ trailing /.
We can't remove /x/../ because if x is a symlink, the result would not be the same directory.
This is required to work for files and directories.
Attempts to convert 'path' to a full path. Returns true if successful.
If path begins with '/', there is nothing to do. If path begins with '~', the user's home directory is inserted. Otherwise, if base is not empty, it is prepended. Otherwise, the result of JGetCurrentDirectory() is prepended.
As a final check, it calls JNameUsed() to check that the result exists. (This allows one to pass in a path+name as well as only a path.)
If it is possible to expand the path, *result will contain the expanded path, even if JNameUsed() fails
Converts 'path' to a path relative to 'base'. Both inputs must be absolute paths. 'path' can include a file name on the end.
Creates a symbolic link dest that points to src.
Creates a unique directory in the specified directory. If path is empty, it uses the system's scratch directory. If prefix is empty, uses temp_dir_.
Returns true if the specified directory can be read from.
Returns true if the specified directory can be written to.
bool JExpandHomeDirShortcut | ( | const JString & | path, |
JString * | result, | ||
JString * | homeDir, | ||
JSize * | homeLength | ||
) |
If the given path begins with ~ or ~x, this is replaced by the appropriate home directory, if it exists. Otherwise, false is returned and *result is empty.
If homeDir != nullptr, it is set to the home directory that was specified by the ~. If homeLength != nullptr it is set to the number of characters at the start of path that specified the home directory.
This function does not check that the resulting expanded path is valid.
If path doesn't begin with ~, returns true, *result = path, *homeDir is empty, and *homeLength = 0.
JString JGetCurrentDirectory | ( | ) |
Returns the full path of the current working directory.
Returns true if the specified user has a home directory.
Returns the last time that the file was modified. Can return JDirEntryDoesNotExist.
Returns the access permissions for the specified file. Can return JDirEntryDoesNotExist.
Returns true if the specified user has a home directory.
Returns true if the current user has a prefs directory.
JString JGetRootDirectory | ( | ) |
Returns true if name is a valid file or a valid directory. trueName is the full, true path to name, without symbolic links.
Deletes the directory and everything in it. Returns true if successful.
if !sync, *p will contain the process
Returns true if the specified name exists. (file, directory, link, etc).
Removes the specified directory. This only works if the directory is empty.
Can return JAccessDenied, JSegFault, JNameTooLong, JBadPath, JComponentNotDirectory, JDirectoryNotEmpty, JDirectoryBusy, JNoKernelMemory, JFileSystemReadOnly, JPathContainsLoop.
Renames the specified directory entry.
Can return JCantRenameFileToDirectory, JCantRenameAcrossFilesystems, JCantRenameToNonemptyDirectory, JFileBusy, JDirectoryCantBeOwnChild, JTooManyLinks, JComponentNotDirectory, JSegFault, JAccessDenied, JNameTooLong, JBadPath, JNoKernelMemory, JFileSystemReadOnly, JPathContainsLoop, JFileSystemFull.
Returns true if the given names point to the same inode in the file system.
Sets the owner to the specified uid and the group to the specified gid.
Sets the access permissions for the specified file.
Can return JAccessDenied, JFileSystemReadOnly, JSegFault, JNameTooLong, JDirEntryDoesNotExist, JNoKernelMemory, JComponentNotDirectory, JPathContainsLoop.