swift
Classes | Static Public Member Functions | List of all members
swift::misc::CDirectoryUtils Class Reference

Utility class for directory operations. More...

Classes

struct  DirComparison
 Result of directory comparison. More...
 

Static Public Member Functions

static bool isInApplicationDirectory (const QString &path)
 Path in application directory.
 
static bool isMacOSAppBundle ()
 Is MacOS application bundle? More...
 
static QString decodeNormalizedDirectory (const QString &directory)
 Virtually the inverse operation of CDirectoryUtils::normalizedApplicationDirectory.
 
static QStringList getRelativeSubDirectories (const QString &rootDir)
 All sub directories of given dir.
 
static bool containsFileInDir (const QString &dir, const QString &filter, bool recursively)
 Any file with filter like "*.txt".
 
static bool existsUnemptyDirectory (const QString &testDir)
 Exists directory and does it contains files.
 
static bool mkPathIfNotExisting (const QString &dir)
 Make directory if not already existing. More...
 
static int copyDirectoryRecursively (const QString &fromDir, const QString &toDir, bool replaceOnConflict)
 Copy directory recursively.
 
static QStringList getExistingUnemptyDirectories (const QStringList &directories)
 Get the existing directories.
 
static bool isSameExistingDirectory (const QString &dir1, const QString &dir2)
 Same existing directories.
 
static bool isSameOrSubDirectoryOf (const QString &testDir, const QString &parentDir)
 Is "testDir" a subdirectory (possibly nested) of "parentDir" or the same directory. More...
 
static bool isSameOrSubDirectoryOf (const QString &testDir, const QDir &parentDir)
 Is "testDir" a subdirectory (possibly nested) of "parentDir" or the same directory. More...
 
static bool isSameOrSubDirectoryOfStringBased (const QString &testDir, const QString &parentDir)
 Is "testDir" a subdirectory (possibly nested) of "parentDir" or the same directory. More...
 
static DirComparison compareTwoDirectories (const QString &dirSource, const QString &dirTarget, bool nestedDirs)
 Compare 2 directories (only files, but with hierarchy)
 
static bool isDirExisting (const QString &path)
 Directory existing? Also checking UNC paths upfront. More...
 
static bool isDirExisting (const QDir &dir)
 Directory existing? Also checking UNC paths upfront. More...
 

Detailed Description

Utility class for directory operations.

Definition at line 21 of file directoryutils.h.

Member Function Documentation

◆ isDirExisting() [1/2]

static bool swift::misc::CDirectoryUtils::isDirExisting ( const QDir &  dir)
static

Directory existing? Also checking UNC paths upfront.

Remarks
Motivation: if an UNC cannot be accessed (e.g. machine is down) it can take very long before functions like QDir respond
for non-UNC paths it is the same as the QDir checks

◆ isDirExisting() [2/2]

static bool swift::misc::CDirectoryUtils::isDirExisting ( const QString &  path)
static

Directory existing? Also checking UNC paths upfront.

Remarks
Motivation: if an UNC cannot be accessed (e.g. machine is down) it can take very long before functions like QDir respond
for non-UNC paths it is the same as the QDir checks

◆ isMacOSAppBundle()

static bool swift::misc::CDirectoryUtils::isMacOSAppBundle ( )
static

Is MacOS application bundle?

Remarks
: Means the currently running executable is a MacOS bundle, but not all our executables are bundles on MacOS

◆ isSameOrSubDirectoryOf() [1/2]

static bool swift::misc::CDirectoryUtils::isSameOrSubDirectoryOf ( const QString &  testDir,
const QDir &  parentDir 
)
static

Is "testDir" a subdirectory (possibly nested) of "parentDir" or the same directory.

Remarks
testing on real directory structure

◆ isSameOrSubDirectoryOf() [2/2]

static bool swift::misc::CDirectoryUtils::isSameOrSubDirectoryOf ( const QString &  testDir,
const QString &  parentDir 
)
static

Is "testDir" a subdirectory (possibly nested) of "parentDir" or the same directory.

Remarks
testing on real directory structure

◆ isSameOrSubDirectoryOfStringBased()

static bool swift::misc::CDirectoryUtils::isSameOrSubDirectoryOfStringBased ( const QString &  testDir,
const QString &  parentDir 
)
static

Is "testDir" a subdirectory (possibly nested) of "parentDir" or the same directory.

Remarks
String based only

◆ mkPathIfNotExisting()

static bool swift::misc::CDirectoryUtils::mkPathIfNotExisting ( const QString &  dir)
static

Make directory if not already existing.

Remarks
returns true if path exists or was created

The documentation for this class was generated from the following file: