MeVisLab Toolbox Reference
ml::ReleaseToolsIO Namespace Reference

A collection of static IO tool functions. More...

Typedefs

typedef std::vector< std::string > StringVector
 Define often used string vector types.
 
typedef std::vector< StringVectorStringVectorVector
 

Functions

MLRELEASE_TOOLS_EXPORT bool calculateDirectoryMatching (const std::string &srcDirBasePath, const std::string &dstDirBasePath, const StringVector &suppressedItems, const bool applyAmbiguityHeuristics, ProgressLogger *logger, StringVector &srcFiles, StringVector &srcDirs, StringVector &dstFiles, StringVector &dstDirs, StringVector &directlyMovedFilesVec, StringVector &directlyMovedDirsVec, StringVector matchingFileVec[2], StringVector &ambiguousMatchingFileVecSrc, StringVectorVector &ambiguousMatchingFilesVec, StringVector &nonMatchingFileVec, StringVector matchingDirVec[2], StringVector &nonMatchingDirVec, StringVector &ambiguousMatchingDirVecSrc, StringVectorVector &ambiguousMatchingDirsVec, StringVector &newDstFiles, StringVector &newDstDirs)
 This function implements a heuristic to find a good matching from files and directories under srcDirBasePath to files and directories under dstDirBasePath.
 
MLRELEASE_TOOLS_EXPORT bool isDICOMTiffPair (const std::string &oneFile, std::string *otherFile=nullptr, std::string *dcmFile=nullptr, std::string *tiffFile=nullptr)
 Returns true if oneFile is one of two files of a DICOM/Tiff pair, otherwise false.
 
MLRELEASE_TOOLS_EXPORT bool hasMLImageSuffix (const std::string &filePathWithName) ML_RETURN_VALUE_SHOULD_BE_USED
 Returns true if the if filePathWithName ends with a string compatible with the .mlimage file format, otherwise false.
 
MLRELEASE_TOOLS_EXPORT bool isFileOrSuffixInList (const std::string &fileNamePath, const std::vector< std::string > sufList) ML_RETURN_VALUE_SHOULD_BE_USED
 Returns true if fileNamePath ends with a string in sufList which has a leading dot, or if it is the same with an entry without leading dot.
 
MLRELEASE_TOOLS_EXPORT std::string searchFileTypeInBinaryHeader (const std::string &fullFilePath) ML_RETURN_VALUE_SHOULD_BE_USED
 If a known one is found then it returns the suffix corresponding to the format, otherwise an empty string is returned.
 
MLRELEASE_TOOLS_EXPORT std::string buildRelativePath (bool useRelativePaths, const std::string &fileRootDirPath, const std::string &fNamePath, bool allowBranchedSubDirs=false, bool allowMultiFrameHandles=false) ML_RETURN_VALUE_SHOULD_BE_USED
 Helper function to make a path relative if it matches a passed parent path.
 
MLRELEASE_TOOLS_EXPORT std::string removeRedundantPathComponents (const std::string &pathAndFileNameStr) ML_RETURN_VALUE_SHOULD_BE_USED
 Removes ".."/ components from pathAndFileNameStr's such as "abc/xyz/../def" by reducing it to "abc/def" if possible.
 
MLRELEASE_TOOLS_EXPORT void removeRedundantPathComponents (const std::string &pathToSimplify, std::string &simplifiedPath)
 Same as removeRedundantPathComponents(const std::string &pathAndFileNameStr) but returning value in simplifiedPath.
 
MLRELEASE_TOOLS_EXPORT void removeRedundantPathComponentsInPlace (std::string &pathToSimplify)
 Same as removeRedundantPathComponents(const std::string &pathAndFileNameStr) but passing input into into and getting out result in pathToSimplifysimplifiedPath.
 
MLRELEASE_TOOLS_EXPORT std::string buildAbsolutePath (bool allowMakeAbsolute, const std::string &fileRootDirPath, const std::string &relativeFileNameStr, bool simplifyPaths=false, bool allowMultiFrameHandles=false) ML_RETURN_VALUE_SHOULD_BE_USED
 Helper function to make a relative path name absolute under some circumstances.
 
MLRELEASE_TOOLS_EXPORT void buildAbsolutePath (bool allowMakeAbsolute, const std::string fileRootDirPath, const std::string &relativeFileNameStrIn, bool simplifyPaths, bool allowMultiFrameHandles, std::string &relPathFileName)
 Same as std::string buildAbsolutePath(...) but returning result in relPathFileName.
 
MLRELEASE_TOOLS_EXPORT std::string appendSingleSlash (const std::string &srcStr) ML_RETURN_VALUE_SHOULD_BE_USED
 Appends a single forward slash to srcStr if it still does not end with one, however, in case of empty strings nothing is appended.
 
MLRELEASE_TOOLS_EXPORT std::vector< std::string > splitFilePath (const std::string &pathLikeString) ML_RETURN_VALUE_SHOULD_BE_USED
 Splits a (path) string into its components.
 
MLRELEASE_TOOLS_EXPORT void splitFilePath (const std::string &pathLikeString, std::vector< std::string > &retPath)
 Same as splitFilePath(const std::string &pathLikeString), only returning the result in retVal;.
 
MLRELEASE_TOOLS_EXPORT void splitPathAndName (std::string fullPathAndName, std::string &fPath, std::string &fName)
 Splits the full path with file fullPathAndName into two components, the base path and the fileName at its end (redundant path components are removed).
 
MLRELEASE_TOOLS_EXPORT std::string substituteNonPathLikeChars (std::string strToCorrect) ML_RETURN_VALUE_SHOULD_BE_USED
 Small helper function to replace some characters not suitable for paths by '-' or '.
 
MLRELEASE_TOOLS_EXPORT MLErrorCode loadStringFile (const std::string &strFileName, std::string &readString) ML_RETURN_VALUE_SHOULD_BE_USED
 Load a binary file into readString and return ML_RESULT_OK on success, ML_FILE_IO_ERROR on other file IO errors or ML_NO_MEMORY on allocation failures.
 
MLRELEASE_TOOLS_EXPORT MLErrorCode reformatColorChannels (const std::vector< SubImage > &frameSubImgs, MLint frameOffset, SubImage &outSubImg, size_t dimIdx, bool isInterleaved, MLint timeUnrollSteps) ML_RETURN_VALUE_SHOULD_BE_USED
 Helper function to copy data from frameSubImages into outSubImg into the dimension given by dimIdx.
 
MLRELEASE_TOOLS_EXPORT bool scanDirectoriesForFiles (ProgressLogger *progressLogger, const std::string &sourceDir, const std::vector< std::string > *suppressedFilesAndSuffixes, bool recursively, std::vector< std::string > &resultFileVector, std::vector< std::string > *resultDirVector=nullptr, bool returnRelativePaths=false, bool alsoSuppressDirectories=false, bool warnNoSourceSourceDir=false, float progressMinimum=0.0, float progressMaximum=1.0, std::vector< std::string > *checkForFileExtensions=nullptr, bool *checkForFileExtensionsFound=nullptr)
 Searches files and directories optionally recursively in sourceDir; if suppressedFilesAndSuffixes is passed non-nullptr then files and/or directories can be suppressed if they match or terminate with any of the elements.
 
MLRELEASE_TOOLS_EXPORT MLErrorCode deleteListOfFiles (std::list< std::string > *fileNameList, ProgressLogger *progressLogger=nullptr)
 Tool function that deletes files for a given list of filenames.
 

Detailed Description

A collection of static IO tool functions.

Typedef Documentation

◆ StringVector

typedef std::vector< std::string > ml::ReleaseToolsIO::StringVector

Define often used string vector types.

Definition at line 27 of file mlDirectoryMatching.h.

◆ StringVectorVector

Function Documentation

◆ appendSingleSlash()

MLRELEASE_TOOLS_EXPORT std::string ml::ReleaseToolsIO::appendSingleSlash ( const std::string & srcStr)

Appends a single forward slash to srcStr if it still does not end with one, however, in case of empty strings nothing is appended.

If multiple forward or backward slashes are at the end of the string they are removed until only one forward slash remains.

◆ buildAbsolutePath() [1/2]

MLRELEASE_TOOLS_EXPORT std::string ml::ReleaseToolsIO::buildAbsolutePath ( bool allowMakeAbsolute,
const std::string & fileRootDirPath,
const std::string & relativeFileNameStr,
bool simplifyPaths = false,
bool allowMultiFrameHandles = false )

Helper function to make a relative path name absolute under some circumstances.

Parameters
allowMakeAbsoluteIf false then always relativeFileNameStr is returned, if true then it is tried to return an absolute path. The absolute path is created by replacing the "./" which is expected at the begin of relativeFileNameStr; if that is not possible or "./" is not at begin then relativeFileNameStr is returned unchanged.
fileRootDirPathPath to be pasted at begin of relativeFileNameStr instead of "./" if "./" it is found and allowMakeAbsolute is true.
relativeFileNameStrThe path to be made absolute.
simplifyPathsIf false (the default) then composed paths do not simplify "./xyz/../abc" patch components to "./abc"; otherwise this simplifications are performed.
allowMultiFrameHandlesAlso handle multi-frame handles in relativeFileNameStr which have an asterisk in their first character.
Returns
The absolute path if relativeFileNameStr could be made absolute, otherwise the unchanged relativeFileNameStr.

◆ buildAbsolutePath() [2/2]

MLRELEASE_TOOLS_EXPORT void ml::ReleaseToolsIO::buildAbsolutePath ( bool allowMakeAbsolute,
const std::string fileRootDirPath,
const std::string & relativeFileNameStrIn,
bool simplifyPaths,
bool allowMultiFrameHandles,
std::string & relPathFileName )

Same as std::string buildAbsolutePath(...) but returning result in relPathFileName.

◆ buildRelativePath()

MLRELEASE_TOOLS_EXPORT std::string ml::ReleaseToolsIO::buildRelativePath ( bool useRelativePaths,
const std::string & fileRootDirPath,
const std::string & fNamePath,
bool allowBranchedSubDirs = false,
bool allowMultiFrameHandles = false )

Helper function to make a path relative if it matches a passed parent path.

Parameters
useRelativePathsIf false then always fNameStr is returned, if true then it is tried to return a relative path. The relative path is created by replacing fileRootDirPath at the begin of fNameStr; if that is not possible then fNameStr is returned unchanged.
fileRootDirPathPath to be searched at begin of fNameStr and to replace by "." if it is found and if useRelativePaths is true. If path already ends with "/" then it is replaced by "./" to assure that the path remains valid. Should be a directory path.
fNamePathThe path and file name to be made relative. Must be a path to a file name or to be more precise: Not to a directory.
allowBranchedSubDirsIf the flag is true then buildRelativePath tries to determine all identical parts of the fileRootDirPath and fNamePath and to append multiple ".." and "subDir" components to build a relative path, otherwise (the default) fileRootDirPath must be an exact starting part of fNamePath.
allowMultiFrameHandlesAlso handle multi-frame handles in fNamePath which have an asterisk in their first character.
Returns
The relative path if fNameStr could be made relative, otherwise the unchanged fNameStr.

References buildRelativePath().

Referenced by buildRelativePath().

◆ calculateDirectoryMatching()

MLRELEASE_TOOLS_EXPORT bool ml::ReleaseToolsIO::calculateDirectoryMatching ( const std::string & srcDirBasePath,
const std::string & dstDirBasePath,
const StringVector & suppressedItems,
const bool applyAmbiguityHeuristics,
ProgressLogger * logger,
StringVector & srcFiles,
StringVector & srcDirs,
StringVector & dstFiles,
StringVector & dstDirs,
StringVector & directlyMovedFilesVec,
StringVector & directlyMovedDirsVec,
StringVector matchingFileVec[2],
StringVector & ambiguousMatchingFileVecSrc,
StringVectorVector & ambiguousMatchingFilesVec,
StringVector & nonMatchingFileVec,
StringVector matchingDirVec[2],
StringVector & nonMatchingDirVec,
StringVector & ambiguousMatchingDirVecSrc,
StringVectorVector & ambiguousMatchingDirsVec,
StringVector & newDstFiles,
StringVector & newDstDirs )

This function implements a heuristic to find a good matching from files and directories under srcDirBasePath to files and directories under dstDirBasePath.

Input parameters:

Parameters
srcDirBasePathAll files and directories under this directory which are not suppressed by suppressedItems are analyzed and the matching to corresponding ones under dstDirBasePath is searched.
dstDirBasePathAll files and directories under this directory which are not suppressed by suppressedItems are analyzed for possible matches from corresponding ones found under srcDirBasePath.
suppressedItemsA list of file names and suffixes (starting with ".") which is skipping matching files found under srcDirBasePath and dstDirBasePath.
applyAmbiguityHeuristicsIf true then a more detailed heuristic is applied to files under srcDirBasePath for which more than one same named version under dstDirBasePath is found.
loggerA pointer to a progress logger which is fed with status information used for interrupt checking if non nullptr. If nullptr then it is ignored.

Result parameters:

Parameters
srcFilesReturns the list of files found under srcDirBasePath.
srcDirsReturns the list of directories found under srcDirBasePath.
dstFilesReturns the list of files found under dstDirBasePath.
dstDirsReturns the list of directories found under dstDirBasePath.
directlyMovedFilesVecReturns the list of files which have the same relative path under srcDirBasePath and dstDirBasePath.
directlyMovedDirsVecReturns the list of directories which have the same relative path under srcDirBasePath and dstDirBasePath.
matchingFileVecReturns the list of files under srcDirBasePath which have exactly one same named file under dstDirBasePath but with different relative path. Element[0] then contains the source path, element[1] the destination path, both are returned with same size.
ambiguousMatchingFileVecSrcList of files under srcDirBasePath which have more than one same named one under dstDirBasePath for which no clear assignment could be determined in ambiguity analysis.
ambiguousMatchingFilesVecVector with same size than ambiguousMatchingFileVecSrc containing a vector of paths for each entry of ambiguousMatchingFileVecSrc which contain the ambiguous matching files under dstDirBasePath.
nonMatchingFileVecList of files under srcDirBasePath for which no same named one could be found under dstDirBasePath.
matchingDirVecReturns the list of directories under srcDirBasePath which have exactly one same named file under dstDirBasePath but with different relative path. Element[0] contains the source path, element[1] the destination path, both are returned with same size.
nonMatchingDirVecList of directories under srcDirBasePath for which no same named one could be found under dstDirBasePath.
ambiguousMatchingDirVecSrcList of directories under srcDirBasePath which have more than one same named one under dstDirBasePath for which no clear assignment could be determined in ambiguity analysis.
ambiguousMatchingDirsVecVector with same size than ambiguousMatchingDirVecSrc containing a vector of paths for each entry of ambiguousMatchingDirVecSrc which contain the ambiguous matching directories under dstDirBasePath.
newDstFilesList of files under dstDirBasePath which have no same named version under srcDirBasePath or where dstDirBasePath contains more/ambiguous ones for one under srcDirBasePath.
newDstDirsList of directories under dstDirBasePath which have no same named version under srcDirBasePath or where dstDirBasePath contains more/ambiguous ones for one under srcDirBasePath.

References calculateDirectoryMatching().

Referenced by calculateDirectoryMatching().

◆ deleteListOfFiles()

MLRELEASE_TOOLS_EXPORT MLErrorCode ml::ReleaseToolsIO::deleteListOfFiles ( std::list< std::string > * fileNameList,
ProgressLogger * progressLogger = nullptr )

Tool function that deletes files for a given list of filenames.

Parameters
fileNameListthe list file names to be deleted
progressLoggerIf non nullptr then message are sent to this logger, otherwise it is ignored and messages are not logged.
Returns
ML_RESULT_OK on success of if there was nothing to clean up or another error code describing the problem.

◆ hasMLImageSuffix()

MLRELEASE_TOOLS_EXPORT bool ml::ReleaseToolsIO::hasMLImageSuffix ( const std::string & filePathWithName)

Returns true if the if filePathWithName ends with a string compatible with the .mlimage file format, otherwise false.

References hasMLImageSuffix().

Referenced by hasMLImageSuffix().

◆ isDICOMTiffPair()

MLRELEASE_TOOLS_EXPORT bool ml::ReleaseToolsIO::isDICOMTiffPair ( const std::string & oneFile,
std::string * otherFile = nullptr,
std::string * dcmFile = nullptr,
std::string * tiffFile = nullptr )

Returns true if oneFile is one of two files of a DICOM/Tiff pair, otherwise false.

If true is returned then also otherFileName is set to the name of the other file of the file pair, otherwise it is set to an empty string. If true is returned then also *dcmFile and *tiffFile are set to the DICOM and Tiff file pair components, respectively. If any of otherFile, dcmFile, or tiffFile is passed as nullptr it will be ignored. Beware, on Windows this check is VERY expensive because it checks for multiple non-existing files.

References isDICOMTiffPair().

Referenced by isDICOMTiffPair().

◆ isFileOrSuffixInList()

MLRELEASE_TOOLS_EXPORT bool ml::ReleaseToolsIO::isFileOrSuffixInList ( const std::string & fileNamePath,
const std::vector< std::string > sufList )

Returns true if fileNamePath ends with a string in sufList which has a leading dot, or if it is the same with an entry without leading dot.

Otherwise is returns false. The comparison is case insensitive (lower and upper cases are considered identical).

References isFileOrSuffixInList().

Referenced by isFileOrSuffixInList().

◆ loadStringFile()

MLRELEASE_TOOLS_EXPORT MLErrorCode ml::ReleaseToolsIO::loadStringFile ( const std::string & strFileName,
std::string & readString )

Load a binary file into readString and return ML_RESULT_OK on success, ML_FILE_IO_ERROR on other file IO errors or ML_NO_MEMORY on allocation failures.

On empty but existing files ML_RESULT_OK is returned and readString will be empty. Although the entire file is read, it will only be assigned to the returned string up to the first null-terminating character (which is appended to the end if it is no part of the file).

◆ reformatColorChannels()

MLRELEASE_TOOLS_EXPORT MLErrorCode ml::ReleaseToolsIO::reformatColorChannels ( const std::vector< SubImage > & frameSubImgs,
MLint frameOffset,
SubImage & outSubImg,
size_t dimIdx,
bool isInterleaved,
MLint timeUnrollSteps )

Helper function to copy data from frameSubImages into outSubImg into the dimension given by dimIdx.

Important: Source and destination subimages must have same data types and must be of integer type, only one special case is supported: outSubImg data type is a standard and integer type and frameSubImgs are of Vector3f type which then is interpreted as interleaved color data (isInterleaved must also be true then). Important: All frameSubImgs must have the same data type.

Parameters
frameSubImgsIs a vector with as many frames as the extent of outSubImage in the dimension given by dimIdx.
frameOffsetValue to be subtracted from a frame index into frameSubImgs; usually needed to load a frame from frameSubImgs[0] which is not positioned at z==0.
outSubImgThe data buffer to be filled with data from frameSubImgs. It must have an extent in dimension dimIdx as frameSubImgs.size().
dimIdxIs the dimension into which the frames are copied.
isInterleavedIf true then the data in frameSubmÍmgs is ordered in RGBRGB...RGB format, otherwise in format RRR...GGG...BBB.
timeUnrollStepsIf frames are spread over z and time dimensions then for each time point we have to jump timeUnrollSteps forward to get the right frame for the corresponding time point. In normal cases where frames are spread over only one dimension this should be 0.

◆ removeRedundantPathComponents() [1/2]

MLRELEASE_TOOLS_EXPORT std::string ml::ReleaseToolsIO::removeRedundantPathComponents ( const std::string & pathAndFileNameStr)

Removes ".."/ components from pathAndFileNameStr's such as "abc/xyz/../def" by reducing it to "abc/def" if possible.

Parameters
pathAndFileNameStrThe path to be cleaned up.
Returns
The simplified path or the unchanged pathAndFileNameStr if no simplifications are possible.

◆ removeRedundantPathComponents() [2/2]

MLRELEASE_TOOLS_EXPORT void ml::ReleaseToolsIO::removeRedundantPathComponents ( const std::string & pathToSimplify,
std::string & simplifiedPath )

Same as removeRedundantPathComponents(const std::string &pathAndFileNameStr) but returning value in simplifiedPath.

◆ removeRedundantPathComponentsInPlace()

MLRELEASE_TOOLS_EXPORT void ml::ReleaseToolsIO::removeRedundantPathComponentsInPlace ( std::string & pathToSimplify)

Same as removeRedundantPathComponents(const std::string &pathAndFileNameStr) but passing input into into and getting out result in pathToSimplifysimplifiedPath.

◆ scanDirectoriesForFiles()

MLRELEASE_TOOLS_EXPORT bool ml::ReleaseToolsIO::scanDirectoriesForFiles ( ProgressLogger * progressLogger,
const std::string & sourceDir,
const std::vector< std::string > * suppressedFilesAndSuffixes,
bool recursively,
std::vector< std::string > & resultFileVector,
std::vector< std::string > * resultDirVector = nullptr,
bool returnRelativePaths = false,
bool alsoSuppressDirectories = false,
bool warnNoSourceSourceDir = false,
float progressMinimum = 0.0,
float progressMaximum = 1.0,
std::vector< std::string > * checkForFileExtensions = nullptr,
bool * checkForFileExtensionsFound = nullptr )

Searches files and directories optionally recursively in sourceDir; if suppressedFilesAndSuffixes is passed non-nullptr then files and/or directories can be suppressed if they match or terminate with any of the elements.

Parameters
progressLoggerUsed for message output and progress updates, allowed to be nullptr.
sourceDirThe directory to be scanned for files which do not have suffixes as described in suppressedFilesAndSuffixes.
suppressedFilesAndSuffixesIf non nullptr then this array of file suffixes (such as ".tif", ".txt") describes the file types not to be added to resultFileVector. Strings not having a leading dot must match case insensitively. Files are excluded only by string matching on file names, but not by content analysis. nullptr as argument is allowed - then no suppression takes place. Note that suppressing directories is off by default; enable alsoSuppressDirectories if directory suppression is also wanted.
recursivelyIf true then directories are recursively parsed; if false then only flat directory scans are performed.
resultFileVectorThe vector to which all found files are appended.
resultDirVectorThe vector to which all found directories are appended if non nullptr. Note that sourceDir itself is not inserted.
returnRelativePathsIf false (the default) then all paths are returned as absolute paths, otherwise relative paths are returned.
alsoSuppressDirectoriesIf true then also directories are suppressed by suppressedFilesAndSuffixes; if false (the default) then directories are not suppressed.
warnNoSourceSourceDirIf true then a warning about a not existing source directory is posted to the prgressLogger (if it exists), otherwise (the default) this issue is ignored.
progressMinimumStart percentage for progress counting.
progressMaximumEnd percentage for progress counting.
checkForFileExtensionsA list of optional file extensions which are checked for existence.
checkForFileExtensionsFoundAn array of bools which are filled with true/false for each checkForFileExtensions extension that is found. Note that these flags are only set to true, they need to be intialized to false by the caller.
Returns
true on interrupted scan and false otherwise.

◆ searchFileTypeInBinaryHeader()

MLRELEASE_TOOLS_EXPORT std::string ml::ReleaseToolsIO::searchFileTypeInBinaryHeader ( const std::string & fullFilePath)

If a known one is found then it returns the suffix corresponding to the format, otherwise an empty string is returned.

Currently a (perhaps incomplete) check for the following file types is performed: ".mlimage", ".pgm", ".pnm", ".png", ".bmp", ".dcm", ".stl", ".tiff", ".tiff", ".jpg", ".pdf".

References searchFileTypeInBinaryHeader().

Referenced by searchFileTypeInBinaryHeader().

◆ splitFilePath() [1/2]

MLRELEASE_TOOLS_EXPORT std::vector< std::string > ml::ReleaseToolsIO::splitFilePath ( const std::string & pathLikeString)

Splits a (path) string into its components.

  • Multiple leading forward or backward slashes are considered as an automounted windows network drive and lead to the insertion of a "//" at the begin of the returned vector to indicate a network drive's name.
  • Single leading separators such as "/" or "\" lead to the insertion of an empty string at vector begin to indicate a path start with root directory. - Starting expressions such as "E:" or "E:/" lead to the insertion of "E:/" at vector begin.
  • An empty string is returned if pathLikeString is empty.
  • In all other cases "/"s and "\"s are considered as separators between path component where multiple occurrences of separators are handled as single separators. - Final ""s or "/"s are handled by appending and empty string to indicate directories.
Parameters
pathLikeStringA path returned by the function scanDirectoriesForFiles.
Returns
A vector of path components of pathLikeString; empty if if pathLikeString is empty. Examples (note that backslashes are not escaped as in c-strings)
"" -> Empty return vector
"E:\" -> "E:\", ""
":\" -> ":\", ""
":/" -> ":\", ""
"/" -> "", ""
"\" -> "", ""
"E:\\test.png" -> "E:\", "test.png"
"E:/test.png" -> "E:\", "test.png"
"test.png" -> "test.png"
"test" -> "test"
"/abc/def/test" -> "", "abc", "def", "test"
"/test.png" -> "", "test.png"
"//test.png" -> "//", "test.png"
"\\test.png" -> "//", "test.png"
"\\//test.png" -> "//", "test.png"
"///test.png/ttt" -> "//", "test.png", "ttt"
"/test.png/" -> "", "test.png", ""
"\test.png\" -> "", "test.png", ""
"/test.png\" -> "", "test.png", ""
":/test.png\\hallo/test with spaces:often\\" ->
":\", "test.png", "hallo", "test with spaces:often", ""
Special case for automounted windows network drives:
"//netDrive/abc.txt" -> "//", "netDrive", "abc.txt"
"\\netDrive/abc.txt" -> "//", "netDrive", "abc.txt"
@ E
Target mlrange_cast(Source arg)
Generic version of checked ML casts.

◆ splitFilePath() [2/2]

MLRELEASE_TOOLS_EXPORT void ml::ReleaseToolsIO::splitFilePath ( const std::string & pathLikeString,
std::vector< std::string > & retPath )

Same as splitFilePath(const std::string &pathLikeString), only returning the result in retVal;.

◆ splitPathAndName()

MLRELEASE_TOOLS_EXPORT void ml::ReleaseToolsIO::splitPathAndName ( std::string fullPathAndName,
std::string & fPath,
std::string & fName )

Splits the full path with file fullPathAndName into two components, the base path and the fileName at its end (redundant path components are removed).

It makes use of splitFilePath and its approaches for drive and root directory handling. fPath - if not empty - will always be terminated with a forward slash, and directories - if they are no special drives or so - will always be separated by forward slashes, too.

Parameters
fullPathAndNameThe file path to be split.
fPathThe result path without file name at its end.
fNameThe result file without path before.

◆ substituteNonPathLikeChars()

MLRELEASE_TOOLS_EXPORT std::string ml::ReleaseToolsIO::substituteNonPathLikeChars ( std::string strToCorrect)

Small helper function to replace some characters not suitable for paths by '-' or '.

' characters. It replaces '/', '\', and ' ' with '-', and '&', '$', and '"' with '.'.