KiCad PCB EDA Suite
Loading...
Searching...
No Matches
io.h File Reference
#include <stdio.h>
#include <cstddef>
#include <cstdint>
#include <vector>

Go to the source code of this file.

Classes

class  KIPLATFORM::IO::MAPPED_FILE
 RAII wrapper for memory-mapped file I/O. More...
 
struct  KIPLATFORM::IO::TARGET_ATTRS
 Opaque snapshot of filesystem attributes that MakeWriteable may alter and that the atomic rename sequence does not preserve by itself. More...
 

Namespaces

namespace  KIPLATFORM
 
namespace  KIPLATFORM::IO
 

Functions

FILE * KIPLATFORM::IO::SeqFOpen (const wxString &aPath, const wxString &mode)
 Opens the file like fopen but sets flags (if available) for sequential read hinting.
 
bool KIPLATFORM::IO::DuplicatePermissions (const wxString &aSrc, const wxString &aDest)
 Duplicates the file security data from one file to another ensuring that they are the same between both.
 
bool KIPLATFORM::IO::MakeWriteable (const wxString &aFilePath)
 Ensures that a file has write permissions.
 
bool KIPLATFORM::IO::IsFileHidden (const wxString &aFileName)
 Helper function to determine the status of the 'Hidden' file attribute.
 
void KIPLATFORM::IO::LongPathAdjustment (wxFileName &aFilename)
 Adjusts a filename to be a long path compatible.
 
long long KIPLATFORM::IO::TimestampDir (const wxString &aDirPath, const wxString &aFilespec)
 Computes a hash of modification times and sizes for files matching a pattern.
 
bool KIPLATFORM::IO::FlushToDisk (FILE *aFp)
 Flushes user-space buffers for aFp and forces the kernel/filesystem to commit the file's data blocks to stable storage.
 
bool KIPLATFORM::IO::FlushDirectory (const wxString &aDirPath)
 Forces a directory entry's metadata to stable storage.
 
bool KIPLATFORM::IO::AtomicRename (const wxString &aSrc, const wxString &aDst, wxString *aError=nullptr)
 Atomically replaces aDst with aSrc.
 
wxString KIPLATFORM::IO::MakeSiblingTempPath (const wxString &aTargetPath)
 Returns a unique sibling path of aTargetPath suitable as an atomic-save temp file.
 
FILE * KIPLATFORM::IO::OpenUniqueSiblingTempFile (const wxString &aTargetPath, const wxString &aMode, wxString *aTempPathOut, wxString *aError=nullptr)
 Opens a fresh sibling temp file next to aTargetPath with exclusive-create semantics (POSIX O_CREAT|O_EXCL, Windows CREATE_NEW).
 
wxString KIPLATFORM::IO::ResolveSymlinkTarget (const wxString &aPath)
 If aPath is a symlink on POSIX, returns the canonical path of its referent so atomic-save operations replace the underlying file rather than the link itself.
 
TARGET_ATTRS KIPLATFORM::IO::CaptureTargetAttributes (const wxString &aPath)
 Captures attributes of an existing aPath that must survive an atomic rename.
 
bool KIPLATFORM::IO::ApplyTargetAttributes (const wxString &aPath, const TARGET_ATTRS &aAttrs)
 Re-applies attributes previously captured by CaptureTargetAttributes.
 
bool KIPLATFORM::IO::CommitTempFile (const wxString &aTempPath, const wxString &aTargetPath, wxString *aError=nullptr)
 Completes an atomic save.
 
bool KIPLATFORM::IO::AtomicWriteFile (const wxString &aTargetPath, const void *aData, size_t aSize, wxString *aError=nullptr)
 Writes aData to aTargetPath via a sibling temp file, fsyncs the data and directory, and atomically replaces the target.
 

Variables

static constexpr size_t KIPLATFORM::IO::CLOUD_SYNC_BUFFER_SIZE = 512 * 1024
 Buffer size for file I/O operations on cloud-synced folders.