導航:首頁 > 文件目錄 > UE軟體裡面文件怎麼刪除

UE軟體裡面文件怎麼刪除

發布時間:2023-07-19 10:31:21

『壹』 UE 文件夾和文件操作

UE有很多針對多平台的操作,其中文件操作也屬於跨平台有差異的操作,UE4將跨平台文件封裝在FPlatformFileManager::Get().GetPlatformFile()之中

如果沒有耐心看細節,只想搬磚就看這里吧
以我的工程myproject為例

先來個常規四件套

CreateDirectoryTree

FPlatformFileManager::Get().GetPlatformFile().CreateDirectoryTree通過調用InternalCreateDirectoryTree,遞歸的創建所有的目錄,就是說,即使父目錄不存在,也會生成相應的目錄。

CreateDirectory
這個函數在IPlatformFile中沒有實現,是由具體的平檯子類實現的,也就是說這個函數才是真的創建目錄的函數,這個函數在父目錄不存在的時候,會返回false。

通過拷貝增加文件夾CopyDirectoryTree
/**

DeleteDirectoryRecursively

DeleteDirectoryRecursively通過FDirectoryVisitor,使用迭代器訪問文件夾,然後將文件夾中的文件和文件夾全部刪除,這個操作是CreateDirectoryTree的逆操作,不同點在於這個操作同時處理了文件。
這個操作執行之後會自己檢查剛才刪除的文件夾是否還在,如果不在的話,返回成功,否則返回失敗。

DeleteDirectory
對應於CreateDirectory,也沒有實現,是由具體的平檯子類實現的,同樣在刪除失敗之後會報錯。

IterateDirectory

UE4定義了IterateDirectory,這個函數由兩個參數,一個是路徑,一個是對便利到的路徑做操作的Visitor,這個Visitor同樣是只有一個介面,具體實現可以自己寫。通過Visitor 和IterateDirectory的相互調用實現了遞歸操作目錄的目的。

IterateDirectoryRecursively

IterateDirectoryRecursively遍歷文件夾的所有子文件夾,並且通過parallelfor加快了訪問速度,在訪問中對訪問進行寫鎖定,並通過底層機制是否線程安全選擇是否多線程執行,是很不錯的便利文件夾的操作,同時這個訪問也要求重寫訪問到指定目錄之後需要做的操作,這里只需要執行具體操作就可以了。

這個操作也是由平檯子類實現,進行文件存在性檢測,如果不存在就返回false

通過拷貝增加文件CopyFile

拷貝文件到指定路徑,如果拷貝失敗或者目標路徑有同名文件,會返回失敗

DeleteFile
刪除指定的文件,具體實現由平檯子類實現

檢查是否可以修改IsReadOnly
通過IsReadOnly檢查文件是否可以修改,具體實現由平檯子類實現

設置是否可以修改SetReadOnly
通過SetReadOnly設置文件是否可以被修改,具體實現由平檯子類實現

移動文件位置或者修改文件名稱MoveFile
通過MoveFile可以移動文件,如果源路徑和目標路徑的目錄相同,就是修改文件名稱了

讀取文件類容 OpenRead

/** Attempt to open a file for writing. If successful will return a non-nullptr pointer. Close the file by delete'ing the handle. /
virtual IFileHandle
OpenWrite(const TCHAR Filename, bool bAppend = false, bool bAllowRead = false) = 0;

/**
* Finds all the files within the given directory, with optional file extension filter
* @param Directory The directory to iterate the contents of
* @param FileExtension If FileExtension is NULL, or an empty string "" then all files are found.
* Otherwise FileExtension can be of the form .EXT or just EXT and only files with that extension will be returned.
* @return FoundFiles All the files that matched the optional FileExtension filter, or all files if none was specified.
/
virtual void FindFiles(TArray<FString>& FoundFiles, const TCHAR
Directory, const TCHAR* FileExtension);

/**
* Finds all the files within the directory tree, with optional file extension filter
* @param Directory The starting directory to iterate the contents. This function explores subdirectories
* @param FileExtension If FileExtension is NULL, or an empty string "" then all files are found.
* Otherwise FileExtension can be of the form .EXT or just EXT and only files with that extension will be returned.
* @return FoundFiles All the files that matched the optional FileExtension filter, or all files if none was specified.
/
virtual void FindFilesRecursively(TArray<FString>& FoundFiles, const TCHAR
Directory, const TCHAR* FileExtension);

閱讀全文

與UE軟體裡面文件怎麼刪除相關的資料

熱點內容
臨床科研課題送審文件有哪些 瀏覽:313
win81激活備份工具 瀏覽:639
bin文件對比工具 瀏覽:488
漳州什麼app加油便宜 瀏覽:792
qq補登卡2天 瀏覽:923
密碼密寫 瀏覽:870
巴基斯坦減稅數據如何獲取 瀏覽:663
網路信息平台的作用 瀏覽:499
bin文件固定大小 瀏覽:380
linux實時監控工具 瀏覽:99
肉肉閱讀網站怎麼打不開 瀏覽:404
行車記錄儀文件儲存路徑 瀏覽:253
如何刪除歷史文件名 瀏覽:646
投標相關證明文件有哪些 瀏覽:306
舉報網站錯了會怎麼樣 瀏覽:12
蘋果7信號變成數字 瀏覽:63
u盤文件讀取變慢 瀏覽:412
怎麼合並兩個ppt文件 瀏覽:323
qq獨立密碼忘記怎麼辦 瀏覽:859
什麼是sq2012資料庫 瀏覽:243

友情鏈接