导航:首页 > 文件目录 > 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软件里面文件怎么删除相关的资料

热点内容
微信图片如何用数据线传电脑 浏览:999
U盘文件夹应用程序 浏览:470
图书馆文献数据库有哪些 浏览:362
压缩文件损坏的头 浏览:817
微信公众号创建好文件怎么发送 浏览:858
xlrd如何将数据写入excel中 浏览:200
微信号货源宣传图 浏览:562
recyclerview版本支持 浏览:98
传输文件出错然后u盘读取不了 浏览:641
编程里面的英文去哪里学方便 浏览:668
90版本天帝tp加点 浏览:117
vivox6和苹果6 浏览:611
编程苦恼怎么办 浏览:140
vuejsref动态改变 浏览:171
哪些软件可用于文件解压 浏览:701
农行u盾原始密码 浏览:371
xp如何弄出一个无线网络连接 浏览:569
word插入pdf只显示文件名称和图标 浏览:150
我想编程一个小软件怎么弄 浏览:168
如何优化文件读取数据java 浏览:262

友情链接