16 #if !defined(OPENNURBS_FILE_UTILITIES_INC_) 17 #define OPENNURBS_FILE_UTILITIES_INC_ 28 static bool PathExists(
32 static bool PathExists(
41 static bool IsDirectory(
50 static bool IsDirectory(
59 static bool IsDirectoryWithWriteAccess(
68 static bool IsDirectoryWithWriteAccess(
99 static bool RemoveFile(
100 const char* file_path
112 static bool RemoveFile(
113 const wchar_t* file_path
133 static const char DirectorySeparatorAsChar;
134 static const wchar_t DirectorySeparator;
136 static const char AlternateDirectorySeparatorAsChar;
137 static const wchar_t AlternateDirectorySeparator;
139 static bool IsDirectorySeparator(
144 static bool IsDirectorySeparator(
193 static void SplitPath(
201 static void SplitPath(
209 static void SplitPath(
217 static void SplitPath(
224 static bool FilePathHas3dmExtension(
225 const wchar_t* file_path,
226 bool bAllow3dmbakExtension
229 static bool FilePathHas3dmExtension(
230 const char* file_path,
231 bool bAllow3dmbakExtension
248 static bool IsValidFileName(
249 const char* file_name,
267 static bool IsValidFileName(
268 const wchar_t* file_name,
301 static const ON_wString VolumeAndDirectoryFromPath(
315 bool bIncludeExtension
325 static const ON_wString FileNameExtensionFromPath(
359 bool bAllowWindowsUNCHostNameOrDiskLetter,
360 bool bDeleteWindowsUNCHostNameOrDiskLetter,
361 const wchar_t directory_separator,
362 const wchar_t* dirty_path
378 static bool IsRelativePath(
380 const wchar_t directory_separator
391 static bool IsRelativePath(
404 const wchar_t* dirty_path
431 const wchar_t* full_path,
432 bool bFullPathIncludesFileName,
433 const wchar_t* base_path,
434 bool bBasePathIncludesFileName
437 static const ON_wString FullPathFromRelativePath(
438 const wchar_t* base_path,
439 bool bBasePathIncludesFileName,
440 const wchar_t* relative_path
451 static bool PlatformPathIgnoreCase();
463 bool bWithTrailingDirectorySeparator
532 const wchar_t* left_side,
533 bool bLeftSideContainsFileName,
534 const wchar_t* right_side,
535 bool bRightSideContainsFileName,
536 bool bAppendTrailingDirectorySeparator
540 enum class PathId : unsigned int
543 DesktopDirectory = 1,
544 DocumentsDirectory = 2,
545 DownloadsDirectory = 3
561 ON_DEPRECATED_MSG(
"Use ON_FileSystem::PathExists")
562 static
bool PathExists(
567 static
bool PathExists(
572 static
bool IsDirectory(
577 static
bool IsDirectory(
606 static FILE* Open(
const wchar_t* filename,
const wchar_t* mode );
619 static FILE* Open(
const char* filename,
const char* mode );
632 static int Close( FILE* fp );
638 static bool Is3dmFile(
639 const wchar_t* file_path,
640 bool bAllow3dmbakExtension
647 static bool Is3dmFile(
648 const char* file_path,
649 bool bAllow3dmbakExtension
659 static FILE* Open3dmToRead(
660 const wchar_t* file_path
670 static FILE* Open3dmToRead(
671 const char* file_path
684 static ON__INT64 CurrentPosition( FILE* fp );
694 static bool SeekFromCurrentPosition( FILE* fp, ON__INT64 offset );
704 static bool SeekFromStart( FILE* fp, ON__INT64 offset );
714 static bool SeekFromEnd( FILE* fp, ON__INT64 offset );
728 static bool Seek( FILE* fp, ON__INT64 offset,
int orgin );
743 static ON__UINT64 Read( FILE* fp, ON__UINT64 count,
void* buffer );
758 static ON__UINT64 Write( FILE* fp, ON__UINT64 count,
const void* buffer );
769 static bool Flush( FILE* fp );
791 static bool GetFileInformation(
793 ON__UINT64* file_size,
794 ON__UINT64* file_metadata_last_modified_time,
795 ON__UINT64* file_contents_last_modified_time
797 static bool GetFileInformation(
798 const wchar_t* file_name,
799 ON__UINT64* file_size,
800 ON__UINT64* file_metadata_last_modified_time,
801 ON__UINT64* file_contents_last_modified_time
803 static bool GetFileInformation(
804 const char* file_name,
805 ON__UINT64* file_size,
806 ON__UINT64* file_metadata_last_modified_time,
807 ON__UINT64* file_contents_last_modified_time
848 ON__UINT64 byte_count,
850 ON__UINT64 hash_time,
851 ON__UINT64 content_last_modified_time
905 const wchar_t* filename
922 bool IsNotSet()
const;
928 ON__UINT64 ByteCount()
const;
934 ON__UINT64 HashCalculationTime()
const;
951 ON__UINT64 ContentLastModifiedTime()
const;
975 bool IsSameBufferContent(
991 bool IsSameFileContent(
1004 bool IsSameFileContent(
1005 const wchar_t* filename
1008 bool IsSameFileContent(
1009 const char* filename
1033 DifferentContent = 2,
1040 DifferentContentFileIsOlder = 3,
1047 ContentDifferentFileIsNewer = 4,
1052 FileDoesNotExist = 5,
1057 FileSystemFailure = 6
1061 unsigned int compare_result_as_unsigned
1084 const wchar_t* file_path,
1107 static bool EqualContent(
1116 static bool DifferentContent(
1126 static int CompareContent(
1153 bool EqualFileNameSizeAndTime(
1154 const wchar_t* filename
1171 ON__UINT64 m_byte_count = 0;
1174 ON__UINT64 m_hash_time = 0;
1178 ON__UINT64 m_content_time = 0;
1192 #pragma region RH_C_SHARED_ENUM [ON_FileReference::Status] [Rhino.FileIO.FileReferenceStatus] [int] 1194 enum class Status : unsigned int
1219 unsigned int full_path_status_as_unsigned
1228 const wchar_t* full_path,
1229 const wchar_t* relative_path,
1235 const wchar_t* full_path,
1236 bool bSetContentHash,
1237 bool bSetFullPathStatus
1240 #pragma region RH_C_SHARED_ENUM [ON_FileReference::FindFilePreference] [Rhino.FileIO.FileFindPreference] [int] 1309 const wchar_t* base_path,
1310 bool bBasePathIncludesFileName,
1342 const wchar_t* base_path,
1343 bool bBasePathIncludesFileName,
1353 const wchar_t* base_path,
1354 bool bBasePathIncludesFileName,
1360 bool bUpdateContentHash,
1370 const wchar_t* base_path,
1371 bool bBasePathIncludesFileName,
1372 bool bUpdateContentHash,
1377 const wchar_t* base_path,
1378 bool bBasePathIncludesFileName,
1379 bool bUpdateContentHash
1392 bool IsNotSet()
const;
1404 bool bUseArchiveDirectoryAsBasePath,
1417 const wchar_t* base_path,
1418 bool bBasePathIncludesFileName,
1435 unsigned int SizeOf()
const;
1438 const wchar_t* FullPathAsPointer()
const;
1440 const wchar_t* full_path,
1441 bool bSetContentHash
1444 const char* full_path,
1445 bool bSetContentHash
1447 void ClearFullPath();
1450 const wchar_t* RelativePathAsPointer()
const;
1451 void SetRelativePath(
1452 const wchar_t* relative_path
1454 void SetRelativePath(
1455 const char* relative_path
1457 void SetRelativePathFromBasePath(
1458 const wchar_t* base_path,
1459 bool bBasePathContainsFileName
1461 void SetRelativePathFromBasePath(
1462 const char* base_path,
1463 bool bBasePathContainsFileName
1465 void ClearRelativePath();
1473 void SetContentHash(
1476 void ClearContentHash();
1478 bool UpdateContentHash();
1498 ON__UINT64 recent_time
1514 void SetFullPathStatus(
1518 ON_UUID EmbeddedFileId()
const;
1519 void SetEmbeddedFileId(
1530 mutable ON_UUID m_embedded_file_id = ON_nil_uuid;
1546 const wchar_t* base_path,
1547 bool bBasePathIncludesFileName,
1549 unsigned int file_preference_count,
1600 const wchar_t* directory_name
1603 const wchar_t* directory_name,
1604 const wchar_t* item_name_filter
1607 const char* directory_name
1610 const char* directory_name,
1611 const char* item_name_filter
1690 ON__UINT64 CurrentItemSize()
const;
1696 bool CurrentItemIsDirectory()
const;
1702 bool CurrentItemIsFile()
const;
1710 bool CurrentItemIsHidden()
const;
1712 const ON_wString CurrentItemFullPathName()
const;
1721 ON__UINT64 CurrentItemLastModifiedTime()
const;
1727 ON__UINT64 CurrentItemCount()
const;
1730 ON__UINT32 m_state = 0;
1731 ON__UINT32 m_reserved = 0;
1742 ON__UINT64 m_count = 0;
1743 class ON_DirectoryIteratorImpl* m_impl =
nullptr;
PathId
ids used by ON_FileSystemPath::GetPath()
Definition: opennurbs_file_utilities.h:511
ON_UUID is a 16 byte universally unique identifier.
Definition: opennurbs_uuid.h:32
static const ON_SHA1_Hash EmptyContentHash
Definition: opennurbs_sha1.h:23
Definition: opennurbs_sha1.h:19
Definition: opennurbs_string.h:2020
FindFilePreference
Defines options for file search.
Definition: opennurbs_file_utilities.h:1180
Definition: opennurbs_file_utilities.h:19
Definition: opennurbs_string.h:852
Definition: opennurbs_file_utilities.h:561
Definition: opennurbs_file_utilities.h:762
Status
Enumerates a list of file statuses.
Definition: opennurbs_file_utilities.h:1132
CompareResult
ON_ContentHash::Compare are the possible results of calling ON_ContentHash::CompareFile().
Definition: opennurbs_file_utilities.h:960
Definition: opennurbs_textlog.h:20
Definition: opennurbs_archive.h:1783
Status of a the full path is not known.
static const ON_SHA1_Hash ZeroDigest
Definition: opennurbs_sha1.h:22
Definition: opennurbs_file_utilities.h:109
Iterates through every item in a file system directory.
Definition: opennurbs_file_utilities.h:1480
Definition: opennurbs_file_utilities.h:1125