Ark Server API (ASA) - Wiki
Loading...
Searching...
No Matches
GenericPlatformFile.h
Go to the documentation of this file.
1// Copyright Epic Games, Inc. All Rights Reserved.
2
3
4/*=============================================================================================
5 GenericPlatformFile.h: Generic platform file interfaces
6==============================================================================================*/
7
8#pragma once
9
10#include "Containers/Array.h"
11#include "Containers/UnrealString.h"
12#include "CoreTypes.h"
13#include "Misc/AssertionMacros.h"
14#include "Misc/DateTime.h"
15#include "Misc/EnumClassFlags.h"
16#include "Templates/Function.h"
17
18class FArchive;
19class IAsyncReadFileHandle;
20class IMappedFileHandle;
21
22/**
23* Enum for async IO priorities.
24*/
26{
27 AIOP_PRIORITY_MASK = 0x000000ff,
28
29 // Flags - combine with priorities if needed
30 AIOP_FLAG_PRECACHE = 0x00000100,
31 AIOP_FLAG_DONTCACHE = 0x00000200,
32
33 // Priorities
42
43 // Legacy (for back-compat). Better to specify priority and AIOP_FLAG_PRECACHE separately
45};
47
48/**
49 * Enum for platform file read flags
50 */
52{
53 None = 0x0,
54 AllowWrite = 0x01 // attempts to open for read while allowing others to write
55};
56
58
59/**
60 * Enum for platform file write flags
61 */
63{
64 None = 0x0,
65 AllowRead = 0x01 // attempts to open for write while allowing others to read
66};
67
69
70/**
71 * Enum for the DirectoryVisitor flags
72 */
74{
75 None = 0x0,
76 ThreadSafe = 0x01 // should be set when the Visit function can be called from multiple threads at once.
77};
78
80
81/**
82 * File handle interface.
83**/
85{
86public:
87 /** Destructor, also the only way to close the file handle **/
88 virtual ~IFileHandle()
89 {
90 }
91
92 /** Return the current write or read position. **/
93 virtual int64 Tell() = 0;
94 /**
95 * Change the current write or read position.
96 * @param NewPosition new write or read position
97 * @return true if the operation completed successfully.
98 **/
99 virtual bool Seek(int64 NewPosition) = 0;
100
101 /**
102 * Change the current write or read position, relative to the end of the file.
103 * @param NewPositionRelativeToEnd new write or read position, relative to the end of the file should be <=0!
104 * @return true if the operation completed successfully.
105 **/
106 virtual bool SeekFromEnd(int64 NewPositionRelativeToEnd = 0) = 0;
107
108 /**
109 * Read bytes from the file.
110 * @param Destination Buffer to holds the results, should be at least BytesToRead in size.
111 * @param BytesToRead Number of bytes to read into the destination.
112 * @return true if the operation completed successfully.
113 **/
114 virtual bool Read(uint8* Destination, int64 BytesToRead) = 0;
115
116 /**
117 * Write bytes to the file.
118 * @param Source Buffer to write, should be at least BytesToWrite in size.
119 * @param BytesToWrite Number of bytes to write.
120 * @return true if the operation completed successfully.
121 **/
122 virtual bool Write(const uint8* Source, int64 BytesToWrite) = 0;
123
124 /**
125 * Flushes file handle to disk.
126 * @param bFullFlush true to flush everything about the file (including its meta-data) with a strong guarantee that it will be on disk by the time this function returns,
127 * or false to let the operating/file system have more leeway about when the data actually gets written to disk
128 * @return true if operation completed successfully.
129 **/
130 virtual bool Flush(const bool bFullFlush = false) = 0;
131
132 /**
133 * Truncate the file to the given size (in bytes).
134 * @param NewSize Truncated file size (in bytes).
135 * @return true if the operation completed successfully.
136 **/
137 virtual bool Truncate(int64 NewSize) = 0;
138
139 /**
140 * Minimizes optional system or process cache kept for the file.
141 **/
142 virtual void ShrinkBuffers()
143 {
144 }
145
146public:
147 /////////// Utility Functions. These have a default implementation that uses the pure virtual operations.
148
149 /** Return the total size of the file **/
150 virtual int64 Size();
151};
152
153
154/**
155 * Contains the information that's returned from stat'ing a file or directory
156 */
158{
163 , FileSize(-1)
164 , bIsDirectory(false)
165 , bIsReadOnly(false)
166 , bIsValid(false)
167 {
168 }
169
170 FFileStatData(FDateTime InCreationTime, FDateTime InAccessTime, FDateTime InModificationTime, const int64 InFileSize, const bool InIsDirectory, const bool InIsReadOnly)
171 : CreationTime(InCreationTime)
172 , AccessTime(InAccessTime)
173 , ModificationTime(InModificationTime)
174 , FileSize(InFileSize)
175 , bIsDirectory(InIsDirectory)
176 , bIsReadOnly(InIsReadOnly)
177 , bIsValid(true)
178 {
179 }
180
181 /** The time that the file or directory was originally created, or FDateTime::MinValue if the creation time is unknown */
183
184 /** The time that the file or directory was last accessed, or FDateTime::MinValue if the access time is unknown */
186
187 /** The time the the file or directory was last modified, or FDateTime::MinValue if the modification time is unknown */
189
190 /** Size of the file (in bytes), or -1 if the file size is unknown */
191 int64 FileSize;
192
193 /** True if this data is for a directory, false if it's for a file */
194 bool bIsDirectory : 1;
195
196 /** True if this file is read-only */
197 bool bIsReadOnly : 1;
198
199 /** True if file or directory was found, false otherwise. Note that this value being true does not ensure that the other members are filled in with meaningful data, as not all file systems have access to all of this data */
200 bool bIsValid : 1;
201};
202
203
204/**
205* File I/O Interface
206**/
208{
209public:
210 /** Physical file system of the _platform_, never wrapped. **/
212 /** Returns the name of the physical platform file type. */
213 static const TCHAR* GetPhysicalTypeName();
214 /** Destructor. */
215 virtual ~IPlatformFile() {}
216
217 /**
218 * Set whether the sandbox is enabled or not
219 *
220 * @param bInEnabled true to enable the sandbox, false to disable it
221 */
222 virtual void SetSandboxEnabled(bool bInEnabled)
223 {
224 }
225
226 /**
227 * Returns whether the sandbox is enabled or not
228 *
229 * @return bool true if enabled, false if not
230 */
231 virtual bool IsSandboxEnabled() const
232 {
233 return false;
234 }
235
236 /**
237 * Checks if this platform file should be used even though it was not asked to be.
238 * i.e. pak files exist on disk so we should use a pak file
239 */
240 virtual bool ShouldBeUsed(IPlatformFile* Inner, const TCHAR* CmdLine) const
241 {
242 return false;
243 }
244
245 /**
246 * Initializes platform file.
247 *
248 * @param Inner Platform file to wrap by this file.
249 * @param CmdLine Command line to parse.
250 * @return true if the initialization was successful, false otherise. */
251 virtual bool Initialize(IPlatformFile* Inner, const TCHAR* CmdLine) = 0;
252
253 /**
254 * Performs initialization of the platform file after it has become the active (FPlatformFileManager.GetPlatformFile() will return this
255 */
256 virtual void InitializeAfterSetActive() { }
257
258 /**
259 * Performs initialization of the platform file after the project path has been set.
260 */
262
263 /**
264 * Build an in memory unique pak file from a subset of files in this pak file
265 */
266 virtual void MakeUniquePakFilesForTheseFiles(const TArray<TArray<FString>>& InFiles) { }
267
268 /**
269 * Performs initialization of the platform file after the new async IO has been enabled
270 */
271 virtual void InitializeNewAsyncIO() { }
272
273 /**
274 * Identifies any platform specific paths that are guaranteed to be local (i.e. cache, scratch space)
275 */
276 virtual void AddLocalDirectories(TArray<FString> &LocalDirectories)
277 {
278 if (GetLowerLevel())
279 {
280 GetLowerLevel()->AddLocalDirectories(LocalDirectories);
281 }
282 }
283
284 virtual void BypassSecurity(bool bInBypass)
285 {
286 if (GetLowerLevel() != nullptr)
287 {
289 }
290 }
291
292 /** Platform file can override this to get a regular tick from the engine */
293 virtual void Tick() { }
294 /** Gets the platform file wrapped by this file. */
296 /** Sets the platform file wrapped by this file. */
297 virtual void SetLowerLevel(IPlatformFile* NewLowerLevel) = 0;
298 /** Gets this platform file type name. */
299 virtual const TCHAR* GetName() const = 0;
300 /** Return true if the file exists. **/
301 virtual bool FileExists(const TCHAR* Filename) = 0;
302 /** Return the size of the file, or -1 if it doesn't exist. **/
303 virtual int64 FileSize(const TCHAR* Filename) = 0;
304 /** Delete a file and return true if the file exists. Will not delete read only files. **/
305 virtual bool DeleteFile(const TCHAR* Filename) = 0;
306 /** Return true if the file is read only. **/
307 virtual bool IsReadOnly(const TCHAR* Filename) = 0;
308 /** Attempt to move a file. Return true if successful. Will not overwrite existing files. **/
309 virtual bool MoveFile(const TCHAR* To, const TCHAR* From) = 0;
310 /** Attempt to change the read only status of a file. Return true if successful. **/
311 virtual bool SetReadOnly(const TCHAR* Filename, bool bNewReadOnlyValue) = 0;
312 /** Return the modification time of a file. Returns FDateTime::MinValue() on failure **/
313 virtual FDateTime GetTimeStamp(const TCHAR* Filename) = 0;
314 /** Sets the modification time of a file **/
315 virtual void SetTimeStamp(const TCHAR* Filename, FDateTime DateTime) = 0;
316 /** Return the last access time of a file. Returns FDateTime::MinValue() on failure **/
317 virtual FDateTime GetAccessTimeStamp(const TCHAR* Filename) = 0;
318 /** For case insensitive filesystems, returns the full path of the file with the same case as in the filesystem */
319 virtual FString GetFilenameOnDisk(const TCHAR* Filename) = 0;
320
321 /** Return true if the file is a symbolic link */
322 virtual bool IsSymlink(const TCHAR* Filename) { unimplemented(); return false; };
323
324 /** Attempt to open a file for reading.
325 *
326 * @param Filename file to be opened
327 * @param bAllowWrite (applies to certain platforms only) whether this file is allowed to be written to by other processes. This flag is needed to open files that are currently being written to as well.
328 *
329 * @return If successful will return a non-nullptr pointer. Close the file by delete'ing the handle.
330 */
331 virtual IFileHandle* OpenRead(const TCHAR* Filename, bool bAllowWrite = false) = 0;
332
333 virtual IFileHandle* OpenReadNoBuffering(const TCHAR* Filename, bool bAllowWrite = false)
334 {
335 return OpenRead(Filename, bAllowWrite);
336 }
337
338
339 /** Attempt to open a file for writing. If successful will return a non-nullptr pointer. Close the file by delete'ing the handle. **/
340 virtual IFileHandle* OpenWrite(const TCHAR* Filename, bool bAppend = false, bool bAllowRead = false) = 0;
341
342 /** Return true if the directory exists. **/
343 virtual bool DirectoryExists(const TCHAR* Directory) = 0;
344 /** Create a directory and return true if the directory was created or already existed. **/
345 virtual bool CreateDirectory(const TCHAR* Directory) = 0;
346 /** Delete a directory and return true if the directory was deleted or otherwise does not exist. **/
347 virtual bool DeleteDirectory(const TCHAR* Directory) = 0;
348
349 /** Return the stat data for the given file or directory. Check the FFileStatData::bIsValid member before using the returned data */
350 virtual FFileStatData GetStatData(const TCHAR* FilenameOrDirectory) = 0;
351
352 /** Base class for file and directory visitors that take only the name. **/
354 {
355 public:
357 : DirectoryVisitorFlags(InDirectoryVisitorFlags)
358 {
359 }
360
361 virtual ~FDirectoryVisitor() { }
362
363 /**
364 * Callback for a single file or a directory in a directory iteration.
365 * @param FilenameOrDirectory If bIsDirectory is true, this is a directory (with no trailing path delimiter), otherwise it is a file name.
366 * @param bIsDirectory true if FilenameOrDirectory is a directory.
367 * @return true if the iteration should continue.
368 **/
369 virtual bool Visit(const TCHAR* FilenameOrDirectory, bool bIsDirectory) = 0;
370
371 /** True if the Visit function can be called from multiple threads at once. **/
373 {
375 }
376
378 };
379
380 /** File and directory visitor function that takes only the name */
381 typedef TFunctionRef<bool(const TCHAR*, bool)> FDirectoryVisitorFunc;
382
383 /** Base class for file and directory visitors that take all the stat data. **/
385 {
386 public:
388 /**
389 * Callback for a single file or a directory in a directory iteration.
390 * @param FilenameOrDirectory If bIsDirectory is true, this is a directory (with no trailing path delimiter), otherwise it is a file name.
391 * @param StatData The stat data for the file or directory.
392 * @return true if the iteration should continue.
393 **/
394 virtual bool Visit(const TCHAR* FilenameOrDirectory, const FFileStatData& StatData) = 0;
395 };
396
397 /** File and directory visitor function that takes all the stat data */
398 typedef TFunctionRef<bool(const TCHAR*, const FFileStatData&)> FDirectoryStatVisitorFunc;
399
400 /**
401 * Call the Visit function of the visitor once for each file or directory in a single directory. This function does not explore subdirectories.
402 * @param Directory The directory to iterate the contents of.
403 * @param Visitor Visitor to call for each element of the directory
404 * @return false if the directory did not exist or if the visitor returned false.
405 **/
406 virtual bool IterateDirectory(const TCHAR* Directory, FDirectoryVisitor& Visitor) = 0;
407
408 /**
409 * Call the Visit function of the visitor once for each file or directory in a single directory. This function does not explore subdirectories.
410 * @param Directory The directory to iterate the contents of.
411 * @param Visitor Visitor to call for each element of the directory
412 * @return false if the directory did not exist or if the visitor returned false.
413 **/
414 virtual bool IterateDirectoryStat(const TCHAR* Directory, FDirectoryStatVisitor& Visitor) = 0;
415
416
417 /////////////////////////////////////////////////////////////////////////////////////////////////////////
418 /////////// Utility Functions. These have a default implementation that uses the pure virtual operations.
419 /////////// Generally, these do not need to be implemented per platform.
420 /////////////////////////////////////////////////////////////////////////////////////////////////////////
421
422 /** Open a file for async reading. This call does not hit the disk or block.
423 *
424 * @param Filename file to be opened
425 * @return Close the file by delete'ing the handle. A non-null return value does not mean the file exists, since that may not be determined yet.
426 */
427 virtual IAsyncReadFileHandle* OpenAsyncRead(const TCHAR* Filename);
428
429 /** Controls if the pak precacher should process precache requests.
430 * Requests below this threshold will not get precached. Without this throttle, quite a lot of memory
431 * can be consumed if the disk races ahead of the CPU.
432 * @param MinPriority the minimum priority at which requests will get precached
433 */
435 {
436 }
437
438 /** Open a file for async reading. This call does hit the disk; it is synchronous open.
439 *
440 * @param Filename file to be mapped. This doesn't actually map anything, just opens the file.
441 * @return Close the file by delete'ing the handle. A non-null return value does mean the file exists.
442 * Null can be returned for many reasons even if the file exists. Perhaps this platform does not support mapped files, or this file is compressed in a pak file.
443 * Generally you attempt to open mapped, and if that fails, then use other file operations instead.
444 */
445 virtual IMappedFileHandle* OpenMapped(const TCHAR* Filename)
446 {
447 return nullptr;
448 }
449
450
451 virtual void GetTimeStampPair(const TCHAR* PathA, const TCHAR* PathB, FDateTime& OutTimeStampA, FDateTime& OutTimeStampB);
452
453 /** Return the modification time of a file in the local time of the calling code (GetTimeStamp returns UTC). Returns FDateTime::MinValue() on failure **/
454 virtual FDateTime GetTimeStampLocal(const TCHAR* Filename);
455
456 /**
457 * Call the visitor once for each file or directory in a single directory. This function does not explore subdirectories.
458 * @param Directory The directory to iterate the contents of.
459 * @param Visitor Visitor to call for each element of the directory (see FDirectoryVisitor::Visit for the signature)
460 * @return false if the directory did not exist or if the visitor returned false.
461 **/
462 virtual bool IterateDirectory(const TCHAR* Directory, FDirectoryVisitorFunc Visitor);
463
464 /**
465 * Call the visitor once for each file or directory in a single directory. This function does not explore subdirectories.
466 * @param Directory The directory to iterate the contents of.
467 * @param Visitor Visitor to call for each element of the directory (see FDirectoryStatVisitor::Visit for the signature)
468 * @return false if the directory did not exist or if the visitor returned false.
469 **/
470 virtual bool IterateDirectoryStat(const TCHAR* Directory, FDirectoryStatVisitorFunc Visitor);
471
472 /**
473 * Call the Visit function of the visitor once for each file or directory in a directory tree. This function explores subdirectories.
474 * @param Directory The directory to iterate the contents of, recursively.
475 * @param Visitor Visitor to call for each element of the directory and each element of all subdirectories.
476 * @return false if the directory did not exist or if the visitor returned false.
477 **/
478 virtual bool IterateDirectoryRecursively(const TCHAR* Directory, FDirectoryVisitor& Visitor);
479
480 /**
481 * Call the Visit function of the visitor once for each file or directory in a directory tree. This function explores subdirectories.
482 * @param Directory The directory to iterate the contents of, recursively.
483 * @param Visitor Visitor to call for each element of the directory and each element of all subdirectories.
484 * @return false if the directory did not exist or if the visitor returned false.
485 **/
486 virtual bool IterateDirectoryStatRecursively(const TCHAR* Directory, FDirectoryStatVisitor& Visitor);
487
488 /**
489 * Call the Visit function of the visitor once for each file or directory in a directory tree. This function explores subdirectories.
490 * @param Directory The directory to iterate the contents of, recursively.
491 * @param Visitor Visitor to call for each element of the directory and each element of all subdirectories (see FDirectoryVisitor::Visit for the signature).
492 * @return false if the directory did not exist or if the visitor returned false.
493 **/
494 virtual bool IterateDirectoryRecursively(const TCHAR* Directory, FDirectoryVisitorFunc Visitor);
495
496 /**
497 * Call the Visit function of the visitor once for each file or directory in a directory tree. This function explores subdirectories.
498 * @param Directory The directory to iterate the contents of, recursively.
499 * @param Visitor Visitor to call for each element of the directory and each element of all subdirectories (see FDirectoryStatVisitor::Visit for the signature).
500 * @return false if the directory did not exist or if the visitor returned false.
501 **/
502 virtual bool IterateDirectoryStatRecursively(const TCHAR* Directory, FDirectoryStatVisitorFunc Visitor);
503
504 /**
505 * Finds all the files within the given directory, with optional file extension filter
506 * @param Directory The directory to iterate the contents of
507 * @param FileExtension If FileExtension is NULL, or an empty string "" then all files are found.
508 * Otherwise FileExtension can be of the form .EXT or just EXT and only files with that extension will be returned.
509 * @return FoundFiles All the files that matched the optional FileExtension filter, or all files if none was specified.
510 */
511 virtual void FindFiles(TArray<FString>& FoundFiles, const TCHAR* Directory, const TCHAR* FileExtension);
512
513 /**
514 * Finds all the files within the directory tree, with optional file extension filter
515 * @param Directory The starting directory to iterate the contents. This function explores subdirectories
516 * @param FileExtension If FileExtension is NULL, or an empty string "" then all files are found.
517 * Otherwise FileExtension can be of the form .EXT or just EXT and only files with that extension will be returned.
518 * @return FoundFiles All the files that matched the optional FileExtension filter, or all files if none was specified.
519 */
520 virtual void FindFilesRecursively(TArray<FString>& FoundFiles, const TCHAR* Directory, const TCHAR* FileExtension);
521
522 /**
523 * Delete all files and subdirectories in a directory, then delete the directory itself
524 * @param Directory The directory to delete.
525 * @return true if the directory was deleted or did not exist.
526 **/
527 virtual bool DeleteDirectoryRecursively(const TCHAR* Directory);
528
529 /** Create a directory, including any parent directories and return true if the directory was created or already existed. **/
530 virtual bool CreateDirectoryTree(const TCHAR* Directory);
531
532 /**
533 * Copy a file. This will fail if the destination file already exists.
534 * @param To File to copy to.
535 * @param From File to copy from.
536 * @param ReadFlags Source file read options.
537 * @param WriteFlags Destination file write options.
538 * @return true if the file was copied sucessfully.
539 **/
540 virtual bool CopyFile(const TCHAR* To, const TCHAR* From, EPlatformFileRead ReadFlags = EPlatformFileRead::None, EPlatformFileWrite WriteFlags = EPlatformFileWrite::None);
541
542 /**
543 * Copy a file or a hierarchy of files (directory).
544 * @param DestinationDirectory Target path (either absolute or relative) to copy to - always a directory! (e.g. "/home/dest/").
545 * @param Source Source file (or directory) to copy (e.g. "/home/source/stuff").
546 * @param bOverwriteAllExisting Whether to overwrite everything that exists at target
547 * @return true if operation completed successfully.
548 */
549 virtual bool CopyDirectoryTree(const TCHAR* DestinationDirectory, const TCHAR* Source, bool bOverwriteAllExisting);
550
551 /**
552 * Converts passed in filename to use an absolute path (for reading).
553 *
554 * @param Filename filename to convert to use an absolute path, safe to pass in already using absolute path
555 *
556 * @return filename using absolute path
557 */
558 virtual FString ConvertToAbsolutePathForExternalAppForRead( const TCHAR* Filename );
559
560 /**
561 * Converts passed in filename to use an absolute path (for writing)
562 *
563 * @param Filename filename to convert to use an absolute path, safe to pass in already using absolute path
564 *
565 * @return filename using absolute path
566 */
567 virtual FString ConvertToAbsolutePathForExternalAppForWrite( const TCHAR* Filename );
568
569 /**
570 * Helper class to send/receive data to the file server function
571 */
573 {
574 public:
576
577 /** Subclass fills out an archive to send to the server */
578 virtual void FillPayload(FArchive& Payload) = 0;
579
580 /** Subclass pulls data response from the server */
581 virtual void ProcessResponse(FArchive& Response) = 0;
582 };
583
584 /**
585 * Sends a message to the file server, and will block until it's complete. Will return
586 * immediately if the file manager doesn't support talking to a server.
587 *
588 * @param Message The string message to send to the server
589 *
590 * @return true if the message was sent to server and it returned success, or false if there is no server, or the command failed
591 */
592 virtual bool SendMessageToServer(const TCHAR* Message, IFileServerMessageHandler* Handler)
593 {
594 // by default, IPlatformFile's can't talk to a server
595 return false;
596 }
597
598 /**
599 * Checks to see if this file system creates publicly accessible files
600 *
601 * @return true if this file system creates publicly accessible files
602 */
604 {
605 return false;
606 }
607
608 /**
609 * Sets file system to create publicly accessible files or not
610 *
611 * @param bCreatePublicFiles true to set the file system to create publicly accessible files
612 */
613 virtual void SetCreatePublicFiles(bool bCreatePublicFiles)
614 {
615 }
616};
617
618/**
619* Common base for physical platform File I/O Interface
620**/
622{
623public:
624 //~ Begin IPlatformFile Interface
625 virtual bool ShouldBeUsed(IPlatformFile* Inner, const TCHAR* CmdLine) const override
626 {
627 return true;
628 }
629 virtual bool Initialize(IPlatformFile* Inner, const TCHAR* CmdLine) override;
630 virtual IPlatformFile* GetLowerLevel() override
631 {
632 return nullptr;
633 }
634 virtual void SetLowerLevel(IPlatformFile* NewLowerLevel) override
635 {
636 check(false); // can't override wrapped platform file for physical platform file
637 }
638 virtual const TCHAR* GetName() const override
639 {
641 }
642 //~ End IPlatformFile Interface
643};
644
645/* Interface class for FPakFile to allow usage from modules that cannot have a compile dependency on FPakFile */
647{
648public:
649 virtual const FString& PakGetPakFilename() const = 0;
650 /**
651 * Return whether the Pak has an entry for the given FileName. Not necessarily exclusive; other Patch Paks may have their own copy of the same File.
652 * @param Filename The full LongPackageName path to the file, as returned from FPackageName::LongPackageNameToFilename + extension. Comparison is case-insensitive.
653 */
654 virtual bool PakContains(const FString& Filename) const = 0;
655 virtual int32 PakGetPakchunkIndex() const = 0;
656 /**
657 * Calls the given Visitor on every FileName in the Pruned Directory Index. FileNames passed to the Vistory are the RelativePath from the Mount of the PakFile
658 * The Pruned Directory Index at Runtime contains only the DirectoryIndexKeepFiles-specified subset of FilesNames and DirectoryNames that exist in the PakFile
659 */
660 virtual void PakVisitPrunedFilenames(IPlatformFile::FDirectoryVisitor& Visitor) const = 0;
661 virtual const FString& PakGetMountPoint() const = 0;
662
663 virtual int32 GetNumFiles() const = 0;
664};
#define check(expr)
#define unimplemented()
#define ENUM_CLASS_FLAGS(Enum)
EDirectoryVisitorFlags
Definition Enums.h:14037
EAsyncIOPriorityAndFlags
Definition Enums.h:5594
EPlatformFileRead
EPlatformFileWrite
@ AIOP_Normal
@ AIOP_High
@ AIOP_BelowNormal
@ AIOP_FLAG_PRECACHE
@ AIOP_CriticalPath
@ AIOP_Precache
@ AIOP_PRIORITY_MASK
@ AIOP_FLAG_DONTCACHE
#define FORCEINLINE
Definition Platform.h:644
virtual void ShrinkBuffers()
virtual bool Flush(const bool bFullFlush=false)=0
virtual bool Seek(int64 NewPosition)=0
virtual ~IFileHandle()
virtual bool Read(uint8 *Destination, int64 BytesToRead)=0
virtual int64 Tell()=0
virtual bool Truncate(int64 NewSize)=0
virtual int64 Size()
virtual bool Write(const uint8 *Source, int64 BytesToWrite)=0
virtual bool SeekFromEnd(int64 NewPositionRelativeToEnd=0)=0
virtual bool PakContains(const FString &Filename) const =0
virtual const FString & PakGetMountPoint() const =0
virtual int32 PakGetPakchunkIndex() const =0
virtual int32 GetNumFiles() const =0
virtual void PakVisitPrunedFilenames(IPlatformFile::FDirectoryVisitor &Visitor) const =0
virtual const FString & PakGetPakFilename() const =0
virtual IPlatformFile * GetLowerLevel() override
virtual const TCHAR * GetName() const override
virtual bool ShouldBeUsed(IPlatformFile *Inner, const TCHAR *CmdLine) const override
virtual bool Initialize(IPlatformFile *Inner, const TCHAR *CmdLine) override
virtual void SetLowerLevel(IPlatformFile *NewLowerLevel) override
virtual bool Visit(const TCHAR *FilenameOrDirectory, const FFileStatData &StatData)=0
FDirectoryVisitor(EDirectoryVisitorFlags InDirectoryVisitorFlags=EDirectoryVisitorFlags::None)
EDirectoryVisitorFlags DirectoryVisitorFlags
virtual bool Visit(const TCHAR *FilenameOrDirectory, bool bIsDirectory)=0
FORCEINLINE bool IsThreadSafe() const
virtual void FillPayload(FArchive &Payload)=0
virtual void ProcessResponse(FArchive &Response)=0
virtual bool ShouldBeUsed(IPlatformFile *Inner, const TCHAR *CmdLine) const
virtual void FindFiles(TArray< FString > &FoundFiles, const TCHAR *Directory, const TCHAR *FileExtension)
virtual void SetCreatePublicFiles(bool bCreatePublicFiles)
virtual bool IterateDirectoryStatRecursively(const TCHAR *Directory, FDirectoryStatVisitorFunc Visitor)
virtual void AddLocalDirectories(TArray< FString > &LocalDirectories)
virtual void InitializeAfterSetActive()
virtual IPlatformFile * GetLowerLevel()=0
virtual bool DoesCreatePublicFiles()
virtual IFileHandle * OpenWrite(const TCHAR *Filename, bool bAppend=false, bool bAllowRead=false)=0
virtual FFileStatData GetStatData(const TCHAR *FilenameOrDirectory)=0
virtual bool DeleteDirectoryRecursively(const TCHAR *Directory)
virtual IMappedFileHandle * OpenMapped(const TCHAR *Filename)
virtual FString ConvertToAbsolutePathForExternalAppForWrite(const TCHAR *Filename)
virtual bool IterateDirectoryStat(const TCHAR *Directory, FDirectoryStatVisitor &Visitor)=0
virtual bool IterateDirectoryStat(const TCHAR *Directory, FDirectoryStatVisitorFunc Visitor)
virtual FString ConvertToAbsolutePathForExternalAppForRead(const TCHAR *Filename)
TFunctionRef< bool(const TCHAR *, const FFileStatData &) FDirectoryStatVisitorFunc)
virtual IFileHandle * OpenRead(const TCHAR *Filename, bool bAllowWrite=false)=0
virtual bool IsSandboxEnabled() const
virtual bool CopyDirectoryTree(const TCHAR *DestinationDirectory, const TCHAR *Source, bool bOverwriteAllExisting)
virtual void BypassSecurity(bool bInBypass)
virtual void SetAsyncMinimumPriority(EAsyncIOPriorityAndFlags MinPriority)
virtual bool IterateDirectory(const TCHAR *Directory, FDirectoryVisitor &Visitor)=0
virtual bool IterateDirectoryStatRecursively(const TCHAR *Directory, FDirectoryStatVisitor &Visitor)
virtual bool IsReadOnly(const TCHAR *Filename)=0
virtual bool DeleteDirectory(const TCHAR *Directory)=0
virtual bool Initialize(IPlatformFile *Inner, const TCHAR *CmdLine)=0
static IPlatformFile & GetPlatformPhysical()
virtual void SetTimeStamp(const TCHAR *Filename, FDateTime DateTime)=0
virtual void FindFilesRecursively(TArray< FString > &FoundFiles, const TCHAR *Directory, const TCHAR *FileExtension)
virtual void Tick()
virtual IFileHandle * OpenReadNoBuffering(const TCHAR *Filename, bool bAllowWrite=false)
virtual bool DirectoryExists(const TCHAR *Directory)=0
virtual void InitializeNewAsyncIO()
virtual bool IsSymlink(const TCHAR *Filename)
virtual bool CreateDirectoryTree(const TCHAR *Directory)
virtual void MakeUniquePakFilesForTheseFiles(const TArray< TArray< FString > > &InFiles)
virtual const TCHAR * GetName() const =0
virtual bool IterateDirectoryRecursively(const TCHAR *Directory, FDirectoryVisitorFunc Visitor)
virtual void GetTimeStampPair(const TCHAR *PathA, const TCHAR *PathB, FDateTime &OutTimeStampA, FDateTime &OutTimeStampB)
virtual bool IterateDirectoryRecursively(const TCHAR *Directory, FDirectoryVisitor &Visitor)
virtual bool SetReadOnly(const TCHAR *Filename, bool bNewReadOnlyValue)=0
virtual void SetSandboxEnabled(bool bInEnabled)
virtual IAsyncReadFileHandle * OpenAsyncRead(const TCHAR *Filename)
virtual bool FileExists(const TCHAR *Filename)=0
virtual int64 FileSize(const TCHAR *Filename)=0
virtual bool IterateDirectory(const TCHAR *Directory, FDirectoryVisitorFunc Visitor)
static const TCHAR * GetPhysicalTypeName()
virtual void SetLowerLevel(IPlatformFile *NewLowerLevel)=0
virtual bool SendMessageToServer(const TCHAR *Message, IFileServerMessageHandler *Handler)
TFunctionRef< bool(const TCHAR *, bool) FDirectoryVisitorFunc)
virtual FDateTime GetTimeStampLocal(const TCHAR *Filename)
virtual FString GetFilenameOnDisk(const TCHAR *Filename)=0
virtual FDateTime GetTimeStamp(const TCHAR *Filename)=0
virtual FDateTime GetAccessTimeStamp(const TCHAR *Filename)=0
virtual void InitializeAfterProjectFilePath()
static FDateTime MinValue()
Definition DateTime.h:645
FFileStatData(FDateTime InCreationTime, FDateTime InAccessTime, FDateTime InModificationTime, const int64 InFileSize, const bool InIsDirectory, const bool InIsReadOnly)