Rhino C++ API  8.14
Static Public Member Functions | List of all members
CRhinoFileUtilities Class Reference

File IO helpers. More...

#include <rhinoSdkFileUtilities.h>

Static Public Member Functions

static bool AppendExtensionToFileName (const wchar_t *sFileName, const wchar_t *sFileExtension, ON_wString &sFileNameWithExtension)
 
static bool AreDirectoriesTheSame (const wchar_t *dir1, const wchar_t *dir2)
 
static BOOL32 BackupExistingFile (const wchar_t *filename, ON_wString &tempname)
 
static int CompareFileNames (const char *sUTF8_FileName1, const char *sUTF8_FileName2)
 
static int CompareFileNames (const wchar_t *sFileName1, const wchar_t *sFileName2)
 
static int ComparePaths (const wchar_t *p1, const wchar_t *p2)
 
static bool CopyFile (const char *sUTF8_OldFileName, const char *sUTF8_NewFileName, bool bFailIfDestinationExists)
 
static bool CopyFile (const wchar_t *sOldFileName, const wchar_t *sNewFileName, bool bFailIfDestinationExists)
 
static bool CreateDir (const wchar_t *lpFullPath)
 
static bool DeleteFile (const char *sUTF8_FileName)
 
static bool DeleteFile (const wchar_t *sFileName)
 
static bool DirExists (const char *lpsFileName)
 
static bool DirExists (const wchar_t *lpsFileName)
 
static bool FileExists (const char *sUTF8_FileName)
 
static bool FileExists (const wchar_t *sFileName)
 
static const char * FileExtensionFromFileName (const char *sUTF8_FileName)
 
static const wchar_t * FileExtensionFromFileName (const wchar_t *sFileName)
 
static bool FileIsNotReadOnly (const char *sUTF8_FileName)
 
static bool FileIsNotReadOnly (const wchar_t *sFileName)
 
static bool FileIsReadOnly (const char *sUTF8_FileName)
 
static bool FileIsReadOnly (const wchar_t *sFileName)
 
static unsigned int FileIsRhino3dm (const char *sUTF8_FileName)
 
static unsigned int FileIsRhino3dm (const wchar_t *sFileName)
 
static bool FileIsWritable (const char *sUTF8_FileName)
 
static bool FileIsWritable (const wchar_t *sFileName)
 
static bool FileNamesAreEqual (const char *sUTF8_FileName1, const char *sUTF8_FileName2)
 
static bool FileNamesAreEqual (const wchar_t *sFileName1, const wchar_t *sFileName2)
 
static bool FindFile (const char *lpsFileName, ON_wString &result)
 
static bool FindFile (const wchar_t *lpsFileName, ON_wString &result)
 
static int FindFile (int first_place_to_look, const wchar_t *full_path, const wchar_t *relative_path, const wchar_t *parent_path, ON_wString &found_file_path)
 
static bool FindFile (unsigned int doc_serial_number, const char *lpsFileName, ON_wString &result)
 
static bool FindFile (unsigned int doc_serial_number, const ON_FileReference &file_reference, ON_wString &full_path_to_found_file)
 
static bool FindFile (unsigned int doc_serial_number, const wchar_t *base_path, bool bBasePathIncludesFileName, const ON_FileReference &file_reference, ON_wString &full_path_to_found_file)
 
static bool FindFile (unsigned int doc_serial_number, const wchar_t *lpsFileName, ON_wString &result)
 
static int FindFile (unsigned int doc_serial_number, int first_place_to_look, const wchar_t *full_path, const wchar_t *relative_path, const wchar_t *parent_path, ON_wString &found_file_path)
 
static bool FindFileAndUpdateReference (unsigned int doc_serial_number, const wchar_t *base_path, bool bBasePathIncludesFileName, ON_FileReference &file_reference, bool bUpdateFileContentHash)
 
static bool GetDefaultRuiFilename (ON_wString &sValue)
 
static bool GetDefaultTemplateFolder (ON_wString &result, int languageid)
 
static CRhinoCommand::result GetDirectory (ON_wString &wDir, BOOL32 bShowDialog=TRUE, HWND hWndParent=NULL)
 
static BOOL32 GetMyDocumentsFolder (ON_wString &result)
 
static BOOL32 GetRhinoApplicationDataFolder (ON_wString &result)
 
static BOOL32 GetRhinoApplicationDataLanguageFolder (ON_wString &result)
 
static bool GetRhinoLocalProfileCurrentLanguageFolder (ON_wString &result)
 
static bool GetRhinoLocalProfileDataFolder (ON_wString &result)
 
static bool GetRhinoRoamingProfileCurrentLanguageFolder (ON_wString &result)
 
static bool GetRhinoRoamingProfileDataFolder (ON_wString &result)
 
static bool GetRhinoRoamingProfileTempFolder (ON_wString &result)
 
static BOOL32 GetWindowsSpecialFolderPath (int nFolder, ON_wString &result)
 
static bool Is3dmBackupFileExtension (const char *sUTF8_FileExtension)
 
static bool Is3dmBackupFileExtension (const wchar_t *sFileExtension)
 
static bool Is3dmFileExtension (const char *sUTF8_FileExtension)
 
static bool Is3dmFileExtension (const wchar_t *sFileExtension)
 
static bool IsBakFileExtension (const char *sUTF8_FileExtension)
 
static bool IsBakFileExtension (const wchar_t *sFileExtension)
 
static bool IsRuiBackupFileExtension (const char *sUTF8_FileExtension)
 
static bool IsRuiBackupFileExtension (const wchar_t *sFileExtension)
 
static bool IsRuiFileExtension (const char *sUTF8_FileExtension)
 
static bool IsRuiFileExtension (const wchar_t *sFileExtension)
 
static bool IsSameFile (const ON_wString &path1, const ON_wString &path2)
 
static bool IsToolbarBackupFileExtension (const char *sUTF8_FileExtension)
 
static bool IsToolbarBackupFileExtension (const wchar_t *sFileExtension)
 
static bool IsToolbarFileExtension (const char *sUTF8_FileExtension)
 
static bool IsToolbarFileExtension (const wchar_t *sFileExtension)
 
static bool IsValidFileName (const char *sUTF8_FileName)
 
static bool IsValidFileName (const wchar_t *sFileName)
 
static bool IsValidPathName (const char *sUTF8_PathName)
 
static bool IsValidPathName (const wchar_t *sPathName)
 
static bool IsWorkSessionBackupFileExtension (const char *sUTF8_FileExtension)
 
static bool IsWorkSessionBackupFileExtension (const wchar_t *sFileExtension)
 
static bool IsWorkSessionFileExtension (const char *sUTF8_FileExtension)
 
static bool IsWorkSessionFileExtension (const wchar_t *sFileExtension)
 
static BOOL32 MakeFullPath (ON_wString &result, const wchar_t *lpsDirectory, const wchar_t *lpsFileName, const wchar_t *lpsExtension=0)
 
static BOOL32 MakeUniqueFilename (ON_wString &result)
 
static bool MakeValidFileName (ON_wString &filename)
 
static bool ModelFolder (ON_wString &result)
 
static bool ModelFolder (unsigned int doc_serial_number, ON_wString &result)
 
static bool ModelPath (unsigned int doc_serial_number, ON_wString &result)
 
static bool MoveFile (const char *sUTF8_OldFileName, const char *sUTF8_NewFileName)
 
static bool MoveFile (const wchar_t *sOldFileName, const wchar_t *sNewFileName)
 
static bool PathAbsoluteFromRelativeTo (const wchar_t *lpsRelativePath, bool bRelativePathisFileName, const wchar_t *lpsRelativeTo, bool bRelativeToIsFileName, ON_wString &wResult)
 
static bool PathIsAbsolute (const wchar_t *lps)
 
static bool PathRelativePathTo (const wchar_t *lpsFrom, bool bFromIsFileName, const wchar_t *lpsRelativeTo, bool bRelativeToIsFileName, ON_wString &wResult)
 
static bool RecycleFile (const wchar_t *sFullPath, bool keepMultipleCopies)
 
static bool RemoveDir (const wchar_t *lpFullPath)
 
static bool RenameFile (const char *sUTF8_OldFileName, const char *sUTF8_NewFileName)
 
static bool RenameFile (const wchar_t *sOldFileName, const wchar_t *sNewFileName)
 
static bool ReplaceFile (const char *sUTF8_DestinationFileName, const char *sUTF8_TemporaryFileName, const char *sUTF8_BackupFileName)
 
static bool ReplaceFile (const wchar_t *sDestinationFileName, const wchar_t *sTemporaryFileName, const wchar_t *sBackupFileName)
 
static BOOL32 RestoreBackupFile (const wchar_t *filename, const wchar_t *tempname)
 

Detailed Description

File IO helpers.

Copyright (c) 1993-2017 Robert McNeel & Associates. All rights reserved. Rhinoceros is a registered trademark of Robert McNeel & Associates.

THIS SOFTWARE IS PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY. ALL IMPLIED WARRANTIES OF FITNESS FOR ANY PARTICULAR PURPOSE AND OF MERCHANTABILITY ARE HEREBY DISCLAIMED.

For complete Rhino SDK copyright information see http://www.rhino3d.com/developer.

Member Function Documentation

◆ AppendExtensionToFileName()

static bool CRhinoFileUtilities::AppendExtensionToFileName ( const wchar_t *  sFileName,
const wchar_t *  sFileExtension,
ON_wString sFileNameWithExtension 
)
static

◆ AreDirectoriesTheSame()

static bool CRhinoFileUtilities::AreDirectoriesTheSame ( const wchar_t *  dir1,
const wchar_t *  dir2 
)
static

Description: Check to see if two directories reference the same folder. This function does not resolve wildly different paths, such as: C:\vol1\myfolder and \myserver\vol1\myfolder Parameters: dir1, dir2: directories to compare Returns: true if directories match, false otherwise

◆ BackupExistingFile()

static BOOL32 CRhinoFileUtilities::BackupExistingFile ( const wchar_t *  filename,
ON_wString tempname 
)
static

Description: Rename existing file while you attempt replace it. Parameters: filename [in] - Name of file to rename. templane [out] - Name of temp file created Returns: TRUE on success.

◆ CompareFileNames() [1/2]

static int CRhinoFileUtilities::CompareFileNames ( const char *  sUTF8_FileName1,
const char *  sUTF8_FileName2 
)
static

Description: Compare file names to see if the identify the same file. Parameters: sFileName1 - [in] sFileName2 - [in] Returns: 0: File names identify the same file <0: sFileName1 < sFileName2 >0: sFileName1 > sFileName2

◆ CompareFileNames() [2/2]

static int CRhinoFileUtilities::CompareFileNames ( const wchar_t *  sFileName1,
const wchar_t *  sFileName2 
)
static

◆ ComparePaths()

static int CRhinoFileUtilities::ComparePaths ( const wchar_t *  p1,
const wchar_t *  p2 
)
static

Description: Compare two path names ignoring case making ignoring the trailing L'\' if it exists on either name. Parameters: p1 [in] - First path to compare p2 [in] - Second path to compare Returns: If p1 < p2, returns -1 If p1 == p2, returns 0 If p2 < p1, returns 1

◆ CopyFile() [1/2]

static bool CRhinoFileUtilities::CopyFile ( const char *  sUTF8_OldFileName,
const char *  sUTF8_NewFileName,
bool  bFailIfDestinationExists 
)
static

Description: Move a file. Parameters: sOldFileName - [in] Name of an existing file. sNewFileName - [in] New name for the file. If a file with this name exists, it is removed. bFailIfDestinationExists - [in] Returns: True if successful.

◆ CopyFile() [2/2]

static bool CRhinoFileUtilities::CopyFile ( const wchar_t *  sOldFileName,
const wchar_t *  sNewFileName,
bool  bFailIfDestinationExists 
)
static

◆ CreateDir()

static bool CRhinoFileUtilities::CreateDir ( const wchar_t *  lpFullPath)
static

Description: Call this method to create a directory on the file system. Parameters: lpFullPath [in] - Full path to the directory to create. Returns: true when: directory already exists or if directory creation succeeds false when: lpFullPath is null lpFullPath is empty directory creation fails lpFullPath is a relative path

◆ DeleteFile() [1/2]

static bool CRhinoFileUtilities::DeleteFile ( const char *  sUTF8_FileName)
static

Description: Delete a file Parameters: sFileName [in] - File name to validate. Returns: true if file existed and was deleted.

◆ DeleteFile() [2/2]

static bool CRhinoFileUtilities::DeleteFile ( const wchar_t *  sFileName)
static

◆ DirExists() [1/2]

static bool CRhinoFileUtilities::DirExists ( const char *  lpsFileName)
static

Description: Check for existence of a directory. Parameters: lpsFileName [in] - Directory name to validate. Returns: TRUE if directory exists.

◆ DirExists() [2/2]

static bool CRhinoFileUtilities::DirExists ( const wchar_t *  lpsFileName)
static

◆ FileExists() [1/2]

static bool CRhinoFileUtilities::FileExists ( const char *  sUTF8_FileName)
static

Description: Check for existence of a file. Parameters: sFileName [in] - File name to validate. Returns: TRUE if file exists.

◆ FileExists() [2/2]

static bool CRhinoFileUtilities::FileExists ( const wchar_t *  sFileName)
static

◆ FileExtensionFromFileName() [1/2]

static const char* CRhinoFileUtilities::FileExtensionFromFileName ( const char *  sUTF8_FileName)
static

Parameters: sUTF8FileName - [in] filename encoded as a uTF-8 string. Returns: If sUTF8_FileName has an extension, then a pointer to the initial '.' in the extension is returned. If sUTF8_FileName does not have an extension, then null_ptr is returned. Remarks: If sUTF8_FileName ends in .3dm.bak, then ".3dm.bak" is returned. See Also: on_splitpath()

◆ FileExtensionFromFileName() [2/2]

static const wchar_t* CRhinoFileUtilities::FileExtensionFromFileName ( const wchar_t *  sFileName)
static

Parameters: sFileName - [in] Returns: If sFileName has an extension, then a pointer to the initial '.' in the extension is returned. If sFileName does not have an extension, then null_ptr is returned. Remarks: If sFileName ends in .3dm.bak, then ".3dm.bak" is returned. See Also: on_wsplitpath()

◆ FileIsNotReadOnly() [1/2]

static bool CRhinoFileUtilities::FileIsNotReadOnly ( const char *  sUTF8_FileName)
static

Description: Determine if a file exists and is not read-only. Parameters: sFileName [in] Returns: True if the file exists and is not read-only.

◆ FileIsNotReadOnly() [2/2]

static bool CRhinoFileUtilities::FileIsNotReadOnly ( const wchar_t *  sFileName)
static

◆ FileIsReadOnly() [1/2]

static bool CRhinoFileUtilities::FileIsReadOnly ( const char *  sUTF8_FileName)
static

Description: Determine if a file exists and is read-only. Parameters: sFileName [in] Returns: True if the file exists and is read-only.

◆ FileIsReadOnly() [2/2]

static bool CRhinoFileUtilities::FileIsReadOnly ( const wchar_t *  sFileName)
static

◆ FileIsRhino3dm() [1/2]

static unsigned int CRhinoFileUtilities::FileIsRhino3dm ( const char *  sUTF8_FileName)
static

Description: Determine if a file is a Rhino 3dm file. Parameters: sFileName [in] Returns: 0: The file is not a Rhino 3dm file. >0: The file is a Rhino 3dm file and the returned value is the earliest version of Rhino that can read the file.

◆ FileIsRhino3dm() [2/2]

static unsigned int CRhinoFileUtilities::FileIsRhino3dm ( const wchar_t *  sFileName)
static

◆ FileIsWritable() [1/2]

static bool CRhinoFileUtilities::FileIsWritable ( const char *  sUTF8_FileName)
static

Description: Check to see if a file with the specified name can be written. Parameters: sFileName [in] - File name to test. Returns: True if the file can be written. Remarks: The file may or may not exist. Use CRhinoFileUtilities::FileExists() if you need to know.

◆ FileIsWritable() [2/2]

static bool CRhinoFileUtilities::FileIsWritable ( const wchar_t *  sFileName)
static

◆ FileNamesAreEqual() [1/2]

static bool CRhinoFileUtilities::FileNamesAreEqual ( const char *  sUTF8_FileName1,
const char *  sUTF8_FileName2 
)
static

◆ FileNamesAreEqual() [2/2]

static bool CRhinoFileUtilities::FileNamesAreEqual ( const wchar_t *  sFileName1,
const wchar_t *  sFileName2 
)
static

◆ FindFile() [1/8]

static bool CRhinoFileUtilities::FindFile ( const char *  lpsFileName,
ON_wString result 
)
static
Deprecated:
use overload that takes doc_serial_number parameter

◆ FindFile() [2/8]

static bool CRhinoFileUtilities::FindFile ( const wchar_t *  lpsFileName,
ON_wString result 
)
static
Deprecated:
use overload that takes doc_serial_number parameter

◆ FindFile() [3/8]

static int CRhinoFileUtilities::FindFile ( int  first_place_to_look,
const wchar_t *  full_path,
const wchar_t *  relative_path,
const wchar_t *  parent_path,
ON_wString found_file_path 
)
static
Deprecated:
use overload that takes doc_serial_number parameter

◆ FindFile() [4/8]

static bool CRhinoFileUtilities::FindFile ( unsigned int  doc_serial_number,
const char *  lpsFileName,
ON_wString result 
)
static

◆ FindFile() [5/8]

static bool CRhinoFileUtilities::FindFile ( unsigned int  doc_serial_number,
const ON_FileReference file_reference,
ON_wString full_path_to_found_file 
)
static

◆ FindFile() [6/8]

static bool CRhinoFileUtilities::FindFile ( unsigned int  doc_serial_number,
const wchar_t *  base_path,
bool  bBasePathIncludesFileName,
const ON_FileReference file_reference,
ON_wString full_path_to_found_file 
)
static

Description: Find a file from an ON_FileReference. Parameters: doc_serial_number - [in] base_path - [in] Typically the location of the file where the current model is saved. Pass nullptr or empty string if you don't have a solid candidate for a base path. When file_reference.FullPath() does not exists or has changed content, base_path is combined with file_reference.RelativePath() to search for the most appropriate file. bBasePathIncludesFileName - [in] True if the base_path parameter includes a file name (that will be ignored) file_reference - [in] full_path_to_found_file - [out] full path to found file or empty. Returns: True if file was found.

◆ FindFile() [7/8]

static bool CRhinoFileUtilities::FindFile ( unsigned int  doc_serial_number,
const wchar_t *  lpsFileName,
ON_wString result 
)
static

Description: Search for file using Rhino's search path. Rhino will look in the following places:

  1. Specified model folder
  2. Path specified in options dialog/File tab
  3. Rhino system folders
  4. Rhino executable folder Parameters: doc_serial_number - [in] Document serial number to use for relative to model searching.
    Pass CRhinoDoc::NullRuntimeSerialNumber to disable searching relative to the model path. lpsFileName - [in] File to find result - [out] Full path to location of file
    Returns: true if file is found.

◆ FindFile() [8/8]

static int CRhinoFileUtilities::FindFile ( unsigned int  doc_serial_number,
int  first_place_to_look,
const wchar_t *  full_path,
const wchar_t *  relative_path,
const wchar_t *  parent_path,
ON_wString found_file_path 
)
static

Description: Find a file by looking where it should be and then looking in places where a user might have moved it. Parameters: first_place_to_look - [in] 1: check the full_path parameter first. 2: check the relative_path parameter first. else: the function decides what is best. full_path - [in] full path to the file including the file name, Pass null if not available. relative_path - [in] relative path to the file relative to "parent_path" including the file name. Pass null if not available. parent_path - [in] full path to the "parent" file, including a file name. doc_serial_number - [in] Document serial number to use for relative to model searching. Pass CRhinoDoc::NullRuntimeSerialNumber to disable searching relative to the model path. found_file_path - [out] If file exists, its full path name is returned here. Returns: 0: unable to find the file 1: file was located at the "full_path" location. 2: file was located at the "relative_path" relative to "parent_path" location 3: Rhino found a likely candidate in the parent directory, model directory, or current working directory, or subdirectory of one of these.

◆ FindFileAndUpdateReference()

static bool CRhinoFileUtilities::FindFileAndUpdateReference ( unsigned int  doc_serial_number,
const wchar_t *  base_path,
bool  bBasePathIncludesFileName,
ON_FileReference file_reference,
bool  bUpdateFileContentHash 
)
static

Description: Find a file from an ON_FileReference. Parameters: doc_serial_number - [in] base_path - [in] Typically the location of the file where the current model is saved. Pass nullptr or empty string if you don't have a solid candidate for a base path. When file_reference.FullPath() does not exists or has changed content, base_path is combined with file_reference.RelativePath() to search for the most appropriate file. bBasePathIncludesFileName - [in] True if the base_path parameter includes a file name (that will be ignored) file_reference - [in/out] If the file is found, file_reference.FullPath() is set to the found file. bUpdateFileContentHash - [in] If a file is found, and bUpdateFileContentHash is true, then the file_reference content hash is set from the found file. Returns: True if file was found.

◆ GetDefaultRuiFilename()

static bool CRhinoFileUtilities::GetDefaultRuiFilename ( ON_wString sValue)
static

Description: Gets the full path to the default .rui file Parameters: sValue: the output value that contains the full path. Returns: true if the default RUI file was found false otherwise

◆ GetDefaultTemplateFolder()

static bool CRhinoFileUtilities::GetDefaultTemplateFolder ( ON_wString result,
int  languageid 
)
static

Description: Get full path to the Rhino 8.0 default template folder for a given language. Parameters: result [out] - Path placed here. languageid [in] - Language to retrieve Returns: If Rhino could figure out the path then TRUE is returned otherwise FALSE is.

◆ GetDirectory()

static CRhinoCommand::result CRhinoFileUtilities::GetDirectory ( ON_wString wDir,
BOOL32  bShowDialog = TRUE,
HWND  hWndParent = NULL 
)
static

Description: Prompt user for directory name. If bShowDialog is TRUE then displays directory dialog complete with edit box which allows user to create a new directory. Parameters: wDir [in] - Default folder. [out] - Folder selected. bShowDialog [in] - If true use dialog otherwise use CRhinoGetString hWndParent [in] - If bShowDialog is TRUE then it is used as the parent window for the directory dialog. If it is NULL then the main Rhino window handle is used. Returns: CRhinoCommand::failure - If bShowDialod is true then there was an error displaying dialog otherwise user typed in an invalid directory name. CRhinoCommand::cancel - User pressed cancel button in dialog or escape when prompted for string. CRhinoCommand::nothing - User pressed enter and wDef did not change. CRhinoCommand::success - Valid directory name entered.

◆ GetMyDocumentsFolder()

static BOOL32 CRhinoFileUtilities::GetMyDocumentsFolder ( ON_wString result)
static

Description: Get full path to "My Documents" folder Parameters: result [out] - Path placed here. Returns: If Rhino could figure out the path then TRUE is returned otherwise FALSE is.

◆ GetRhinoApplicationDataFolder()

static BOOL32 CRhinoFileUtilities::GetRhinoApplicationDataFolder ( ON_wString result)
static

Description: Get full path to Rhino Application Data folder. This is the folder where Rhino stores global data that is shared between all users on the system.

Windows 95, 98, ME: usually someplace like "C:\Program Files\Rhinoceros" Windows NT4, 2000, XP: usually someplace like "C:\Documents and Settings\All Users\Application Data\McNeel\Rhinoceros\5.0\" Windows Vista, 7: usually someplace like "C:\ProgramData\McNeel\Rhinoceros\5.0\" Parameters: result [out] - Path placed here. Returns: If Rhino could figure out the path then TRUE is returned otherwise FALSE is.

◆ GetRhinoApplicationDataLanguageFolder()

static BOOL32 CRhinoFileUtilities::GetRhinoApplicationDataLanguageFolder ( ON_wString result)
static

Description: Get full path to Rhino Application Data languagefolder. This is the folder where Rhino stores global language data that is shared between all users on the system. Usually someplace like "C:\ProgramData\McNeel\Rhinoceros\8.0\Localization\en-US" Parameters: result [out] - Path placed here. Returns: If Rhino could figure out the path then TRUE is returned otherwise FALSE is.

◆ GetRhinoLocalProfileCurrentLanguageFolder()

static bool CRhinoFileUtilities::GetRhinoLocalProfileCurrentLanguageFolder ( ON_wString result)
static

Description: Get full path to a Rhino 5.0 specific sub-folder under the per-user Roaming Profile folder where localized resources are stored. This folder changes for each language.

Windows NT4, 2000, XP: usually someplace like "C:\Documents and Settings\[USERNAME]\Local Settings\Application Data\McNeel\Rhinoceros\5.0\Localization\en" Windows Vista, 7: usually someplace like "C:\Users\[USERNAME]\AppData\Local\McNeel\Rhinoceros\5.0\Localization\en" Parameters: result [out] - Path placed here. Returns: If Rhino could figure out the path then TRUE is returned otherwise FALSE is.

◆ GetRhinoLocalProfileDataFolder()

static bool CRhinoFileUtilities::GetRhinoLocalProfileDataFolder ( ON_wString result)
static

Description: Get full path to a Rhino 5.0 specific sub-folder under the per-user Local (non-roaming) Profile folder. This is the folder where user-specific data is stored.

Windows NT4, 2000, XP: usually someplace like "C:\Documents and Settings\[USERNAME]\Local Settings\Application Data\McNeel\Rhinoceros\5.0\" Windows Vista, 7: usually someplace like "C:\Users\[USERNAME]\AppData\Local\McNeel\Rhinoceros\5.0\" Parameters: result [out] - Path placed here. Returns: If Rhino could figure out the path then TRUE is returned otherwise FALSE is.

◆ GetRhinoRoamingProfileCurrentLanguageFolder()

static bool CRhinoFileUtilities::GetRhinoRoamingProfileCurrentLanguageFolder ( ON_wString result)
static

Description: Get full path to a Rhino 5.0 specific sub-folder under the per-user Roaming Profile folder where localized resources are stored. This folder changes for each language.

Windows NT4, 2000, XP: usually someplace like "C:\Documents and Settings\[USERNAME]\Application Data\McNeel\Rhinoceros\5.0\Localization\en" Windows Vista, 7: usually someplace like "C:\Users\[USERNAME]\AppData\Roaming\McNeel\Rhinoceros\5.0\Localization\en" Parameters: result [out] - Path placed here. Returns: If Rhino could figure out the path then TRUE is returned otherwise FALSE is.

◆ GetRhinoRoamingProfileDataFolder()

static bool CRhinoFileUtilities::GetRhinoRoamingProfileDataFolder ( ON_wString result)
static

Description: Get full path to a Rhino 5.0 specific sub-folder under the per-user Roaming Profile folder. This is the folder where user-specific data is stored.

Windows NT4, 2000, XP: usually someplace like "C:\Documents and Settings\[USERNAME]\Application Data\McNeel\Rhinoceros\5.0\" Windows Vista, 7: usually someplace like "C:\Users\[USERNAME]\AppData\Roaming\McNeel\Rhinoceros\5.0\" Parameters: result [out] - Path placed here. Returns: If Rhino could figure out the path then TRUE is returned otherwise FALSE is.

◆ GetRhinoRoamingProfileTempFolder()

static bool CRhinoFileUtilities::GetRhinoRoamingProfileTempFolder ( ON_wString result)
static

Description: Get full path to a Rhino 5.0 specific sub-folder under the per-user Roaming Profile folder. This is the folder where user-specific temporary files are created.

If a file in this directory is more than 4 days old, it will be deleted when Rhino starts.

Windows NT4, 2000, XP: usually someplace like "C:\Documents and Settings\[USERNAME]\Application Data\McNeel\Rhinoceros\5.0\...\Temp\" Windows Vista, 7: usually someplace like "C:\Users\[USERNAME]\AppData\Roaming\McNeel\Rhinoceros\5.0\...\Temp\" Parameters: result [out] - Path placed here. Returns: If Rhino could figure out the path then TRUE is returned otherwise FALSE is.

◆ GetWindowsSpecialFolderPath()

static BOOL32 CRhinoFileUtilities::GetWindowsSpecialFolderPath ( int  nFolder,
ON_wString result 
)
static

Description: Get Special Folder Paths from such as "My Documents", "Application Data", "Network Neighborhood", etc...

A wrapper around Microsoft's ShFolder.dll implementation of SHGetFolderPath. The ShFolder.dll implementation works consistently across all platforms (but the ShFolder.dll implementation does not). Parameters: result [out] - Path placed here. nFolder [in] - CSIDL constant as described in Microsoft's SHGetFolderPath documentation. Returns: If Rhino could figure out the path then TRUE is returned otherwise FALSE is.

◆ Is3dmBackupFileExtension() [1/2]

static bool CRhinoFileUtilities::Is3dmBackupFileExtension ( const char *  sUTF8_FileExtension)
static

Returns: True if sExt is ".3dmbak", "3dmbak", ".3dm.bak", "3dm.bak", ".3dx.bak" or "3dx.bak", ignoring case.

◆ Is3dmBackupFileExtension() [2/2]

static bool CRhinoFileUtilities::Is3dmBackupFileExtension ( const wchar_t *  sFileExtension)
static

◆ Is3dmFileExtension() [1/2]

static bool CRhinoFileUtilities::Is3dmFileExtension ( const char *  sUTF8_FileExtension)
static

Returns: True if sExt is ".3dm", "3dm", ".3dx" or "3dx", ignoring case.

◆ Is3dmFileExtension() [2/2]

static bool CRhinoFileUtilities::Is3dmFileExtension ( const wchar_t *  sFileExtension)
static

◆ IsBakFileExtension() [1/2]

static bool CRhinoFileUtilities::IsBakFileExtension ( const char *  sUTF8_FileExtension)
static

Returns: True if sExt is ".bak" or "bak", ignoring case.

◆ IsBakFileExtension() [2/2]

static bool CRhinoFileUtilities::IsBakFileExtension ( const wchar_t *  sFileExtension)
static

◆ IsRuiBackupFileExtension() [1/2]

static bool CRhinoFileUtilities::IsRuiBackupFileExtension ( const char *  sUTF8_FileExtension)
static

Returns: True if sExt is ".ruibak", "ruibak", ".rui.bak" or "rui.bak", ignoring case.

◆ IsRuiBackupFileExtension() [2/2]

static bool CRhinoFileUtilities::IsRuiBackupFileExtension ( const wchar_t *  sFileExtension)
static

◆ IsRuiFileExtension() [1/2]

static bool CRhinoFileUtilities::IsRuiFileExtension ( const char *  sUTF8_FileExtension)
static

Returns: True if sExt is ".rui" or "rui", ignoring case.

◆ IsRuiFileExtension() [2/2]

static bool CRhinoFileUtilities::IsRuiFileExtension ( const wchar_t *  sFileExtension)
static

◆ IsSameFile()

static bool CRhinoFileUtilities::IsSameFile ( const ON_wString path1,
const ON_wString path2 
)
static

Description: Compare the two existing files at the specified paths to see if they are the same file (not equal or similar - but that the paths resolve to the same location) For example, this function can determine if a UNC path and a mapped drive resolve to the same location, or if a UNC path specified with an IP address maps to the same location as one with a netbios name. Parameters: path1 [in] - First path to file path2 [in] - Second path to file Returns: true if the paths resolve to the same location false if they don't.

◆ IsToolbarBackupFileExtension() [1/2]

static bool CRhinoFileUtilities::IsToolbarBackupFileExtension ( const char *  sUTF8_FileExtension)
static

Returns: True if sExt is ".tbbak", "tbbak", ".tb.bak" or "tb.bak", ignoring case.

◆ IsToolbarBackupFileExtension() [2/2]

static bool CRhinoFileUtilities::IsToolbarBackupFileExtension ( const wchar_t *  sFileExtension)
static

◆ IsToolbarFileExtension() [1/2]

static bool CRhinoFileUtilities::IsToolbarFileExtension ( const char *  sUTF8_FileExtension)
static

Returns: True if sExt is ".tb" or "tb", ignoring case.

◆ IsToolbarFileExtension() [2/2]

static bool CRhinoFileUtilities::IsToolbarFileExtension ( const wchar_t *  sFileExtension)
static

◆ IsValidFileName() [1/2]

static bool CRhinoFileUtilities::IsValidFileName ( const char *  sUTF8_FileName)
static

◆ IsValidFileName() [2/2]

static bool CRhinoFileUtilities::IsValidFileName ( const wchar_t *  sFileName)
static

◆ IsValidPathName() [1/2]

static bool CRhinoFileUtilities::IsValidPathName ( const char *  sUTF8_PathName)
static

Returns true if path name does not contain the characters listed below | : * ? " < >

◆ IsValidPathName() [2/2]

static bool CRhinoFileUtilities::IsValidPathName ( const wchar_t *  sPathName)
static

◆ IsWorkSessionBackupFileExtension() [1/2]

static bool CRhinoFileUtilities::IsWorkSessionBackupFileExtension ( const char *  sUTF8_FileExtension)
static

Returns: True if sExt is ".rwsbak", "rwsbak", ".wsbak", "wsbak", ".ws3bak", "ws3bak", ".rws.bak", "rws.bak", ".ws.bak", "ws.bak", ".ws3.bak" or "ws3.bak", ignoring case.

ignoring case.

◆ IsWorkSessionBackupFileExtension() [2/2]

static bool CRhinoFileUtilities::IsWorkSessionBackupFileExtension ( const wchar_t *  sFileExtension)
static

◆ IsWorkSessionFileExtension() [1/2]

static bool CRhinoFileUtilities::IsWorkSessionFileExtension ( const char *  sUTF8_FileExtension)
static

Returns: True if sExt is ".rws", "rws", ".ws", "ws", ".ws3" or "ws3", ignoring case.

◆ IsWorkSessionFileExtension() [2/2]

static bool CRhinoFileUtilities::IsWorkSessionFileExtension ( const wchar_t *  sFileExtension)
static

◆ MakeFullPath()

static BOOL32 CRhinoFileUtilities::MakeFullPath ( ON_wString result,
const wchar_t *  lpsDirectory,
const wchar_t *  lpsFileName,
const wchar_t *  lpsExtension = 0 
)
static

Description: Create full path to file using directory and extension if supplied. Is smart enough to figure out if it needs to add the '\' between directory and file name. Parameters: result [out] - Complete path placed here lpsDirectory [in] - Directory name with or without trailing '\' lpsFileName [in] - File name lpsExtension [in] - File extension with or without '.' Returns: Returns TRUE if lpsDirectory and lpsFile name are not NULL or empty strings

◆ MakeUniqueFilename()

static BOOL32 CRhinoFileUtilities::MakeUniqueFilename ( ON_wString result)
static

Description: Create a unique temporary file name. Parameters: result [out] - File name output to this object. Returns: TRUE if successful.

◆ MakeValidFileName()

static bool CRhinoFileUtilities::MakeValidFileName ( ON_wString filename)
static

◆ ModelFolder() [1/2]

static bool CRhinoFileUtilities::ModelFolder ( ON_wString result)
static
Deprecated:
use overload that takes doc_serial_number parameter

◆ ModelFolder() [2/2]

static bool CRhinoFileUtilities::ModelFolder ( unsigned int  doc_serial_number,
ON_wString result 
)
static

Description: Get full path to the specified model. If the model has no name then the working folder is returned. Parameters: doc_serial_number [in] - serial number of the specified model result [out] - Buffer to get folder name. Returns: TRUE if successful otherwise FALSE.

◆ ModelPath()

static bool CRhinoFileUtilities::ModelPath ( unsigned int  doc_serial_number,
ON_wString result 
)
static

Description: Get full path to the specified model. If the model has no name then the working folder is returned. Parameters: doc_serial_number [in] - serial number of the specified model result [out] - Buffer to get folder name. Returns: TRUE if successful otherwise FALSE.

◆ MoveFile() [1/2]

static bool CRhinoFileUtilities::MoveFile ( const char *  sUTF8_OldFileName,
const char *  sUTF8_NewFileName 
)
static

Description: Move a file. Parameters: sOldFileName - [in] Name of an existing file. sNewFileName - [in] New name for the file. If a file with this name exists, it is removed. Returns: True if successful.

◆ MoveFile() [2/2]

static bool CRhinoFileUtilities::MoveFile ( const wchar_t *  sOldFileName,
const wchar_t *  sNewFileName 
)
static

◆ PathAbsoluteFromRelativeTo()

static bool CRhinoFileUtilities::PathAbsoluteFromRelativeTo ( const wchar_t *  lpsRelativePath,
bool  bRelativePathisFileName,
const wchar_t *  lpsRelativeTo,
bool  bRelativeToIsFileName,
ON_wString wResult 
)
static

Description: Call this method to convert a relative path to an absolute path relative to the specified path. Parameters: lpsRelativePath [in] - Relative path to convert to an absolute path bRelativePathisFileName [in] - If true then lpsFrom is treated as a file name otherwise it is treated as a directory name lpsRelativeTo [in] - File or folder the path is relative to bRelativeToIsFileName [in] - If true then lpsFrom is treated as a file name otherwise it is treated as a directory name wResult [out] - Reference to ON_wString which will receive the computed absolute path Returns: Returns true if parameters are valid and lpsRelativePath is indeed relative to lpsRelativeTo otherwise returns false

◆ PathIsAbsolute()

static bool CRhinoFileUtilities::PathIsAbsolute ( const wchar_t *  lps)
static

Description: Call this method to find out if the specified file or directory name is an absolute path and not a relative one. Parameters: lps [in] - File or directory name to test Returns: Returns true if lps is absolute which means it is prefixed with a drive letter or "\\" otherwise returns false

◆ PathRelativePathTo()

static bool CRhinoFileUtilities::PathRelativePathTo ( const wchar_t *  lpsFrom,
bool  bFromIsFileName,
const wchar_t *  lpsRelativeTo,
bool  bRelativeToIsFileName,
ON_wString wResult 
)
static

Description: Call this method to convert an absolute path to a path relative to another file name or folder. Parameters: lpsFrom [in] - File or directory name to convert. bFromIsFileName [in] - If true then lpsFrom is treated as a file name otherwise it is treated as a directory name lpsRelativeTo [in] - File or folder you whish to make lpsFrom relative to bRelativeToIsFileName [in] - If true then lpsRelativeTo is treated as a file name otherwise it is treated as a directory name wResult [out] - Reference to ON_wString which will receive the computed relative path Returns: Returns true if parameters are valid and lpsFrom is indeed relative to lpsRelativeTo otherwise returns false

◆ RecycleFile()

static bool CRhinoFileUtilities::RecycleFile ( const wchar_t *  sFullPath,
bool  keepMultipleCopies 
)
static

◆ RemoveDir()

static bool CRhinoFileUtilities::RemoveDir ( const wchar_t *  lpFullPath)
static

Description: Call this method to remove an empty directory on the file system. Parameters: lpFullPath [in] - Full path to the empty directory to remove. Returns: true when: directory already removed or if directory removal succeeds false when: lpFullPath is null lpFullPath is empty directory removal fails lpFullPath is a relative path

◆ RenameFile() [1/2]

static bool CRhinoFileUtilities::RenameFile ( const char *  sUTF8_OldFileName,
const char *  sUTF8_NewFileName 
)
static

Description: Rename a file. Parameters: sOldFileName - [in] Name of an existing file. sNewFileName - [in] New name for the file. No current file must have this name. Returns: True if successful.

◆ RenameFile() [2/2]

static bool CRhinoFileUtilities::RenameFile ( const wchar_t *  sOldFileName,
const wchar_t *  sNewFileName 
)
static

◆ ReplaceFile() [1/2]

static bool CRhinoFileUtilities::ReplaceFile ( const char *  sUTF8_DestinationFileName,
const char *  sUTF8_TemporaryFileName,
const char *  sUTF8_BackupFileName 
)
static

Description: Replace a file with a temporary file and, optionally, back up the original file. Parameters: sDestinationFileName - [in] The name of the destination file. This file may or may not exist. sTemporaryFileName - [in] Name of the temporary file. This file must exist. sBackupFileName - [in] nullptr for no backup file. If sBackupFileName is not empty and a file named sDestinationFileName exists, then the original file named sDestinationFileName is renamed sBackupFileName. Returns: True if successful.

◆ ReplaceFile() [2/2]

static bool CRhinoFileUtilities::ReplaceFile ( const wchar_t *  sDestinationFileName,
const wchar_t *  sTemporaryFileName,
const wchar_t *  sBackupFileName 
)
static

◆ RestoreBackupFile()

static BOOL32 CRhinoFileUtilities::RestoreBackupFile ( const wchar_t *  filename,
const wchar_t *  tempname 
)
static

Description: Rename <tempname> as <filename>. If <filename> exists then it is deleted and <tempname> is renamed. Parameters: filename [in] - Original file name tempname [in] - Temporary backup file to rename Returns: