KiCad PCB EDA Suite
Loading...
Searching...
No Matches
KIPLATFORM::IO Namespace Reference

Functions

FILE * SeqFOpen (const wxString &aPath, const wxString &mode)
 Opens the file like fopen but sets flags (if available) for sequential read hinting.
 
bool 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 MakeWriteable (const wxString &aFilePath)
 Ensures that a file has write permissions.
 
bool IsFileHidden (const wxString &aFileName)
 Helper function to determine the status of the 'Hidden' file attribute.
 
void LongPathAdjustment (wxFileName &aFilename)
 Adjusts a filename to be a long path compatible.
 
long long TimestampDir (const wxString &aDirPath, const wxString &aFilespec)
 Computes a hash of modification times and sizes for files matching a pattern.
 

Function Documentation

◆ DuplicatePermissions()

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.

This assumes that the user has permission to set #aDest

Returns
true if the process was successful

Definition at line 51 of file unix/io.cpp.

Referenced by PL_EDITOR_FRAME::SaveDrawingSheetFile(), STEP_PCB_MODEL::WriteGLTF(), STEP_PCB_MODEL::WritePDF(), STEP_PCB_MODEL::WritePLY(), STEP_PCB_MODEL::WriteSTEP(), STEP_PCB_MODEL::WriteSTL(), and STEP_PCB_MODEL::WriteU3D().

◆ IsFileHidden()

bool KIPLATFORM::IO::IsFileHidden ( const wxString & aFileName)

Helper function to determine the status of the 'Hidden' file attribute.

Returns
true if the file attribut is set.

Definition at line 89 of file unix/io.cpp.

Referenced by PROJECT_TREE_PANE::addItemToProjectTree().

◆ LongPathAdjustment()

void KIPLATFORM::IO::LongPathAdjustment ( wxFileName & aFilename)

Adjusts a filename to be a long path compatible.

This is a no-op on non-Windows platforms.

Definition at line 97 of file unix/io.cpp.

◆ MakeWriteable()

bool KIPLATFORM::IO::MakeWriteable ( const wxString & aFilePath)

Ensures that a file has write permissions.

This is useful after copying files that may have been read-only.

Parameters
aFilePathpath to the file to make writeable
Returns
true if the process was successful

Definition at line 74 of file unix/io.cpp.

Referenced by PCB_EDIT_FRAME::SavePcbCopy(), PCB_EDIT_FRAME::SavePcbFile(), and SCH_EDIT_FRAME::saveSchematicFile().

◆ SeqFOpen()

FILE * KIPLATFORM::IO::SeqFOpen ( const wxString & aPath,
const wxString & mode )

Opens the file like fopen but sets flags (if available) for sequential read hinting.

Only use this variant of fopen if the file is truely going to be read sequentially only otherwise you may encounter performance penalities.

Windows in particular is a little ulgy to set the sequential scan flag compared to say linux and it's posix_fadvise

Definition at line 35 of file unix/io.cpp.

Referenced by FILE_LINE_READER::FILE_LINE_READER().

◆ TimestampDir()

long long KIPLATFORM::IO::TimestampDir ( const wxString & aDirPath,
const wxString & aFilespec )

Computes a hash of modification times and sizes for files matching a pattern.

Used for cache invalidation by detecting changes to library directories.

Parameters
aDirPathDirectory to search
aFilespecWildcard pattern to match (e.g. "*.kicad_mod")
Returns
Hash value that changes when any matching file is modified

Definition at line 103 of file unix/io.cpp.

Referenced by SCH_IO_LIB_CACHE::GetLibModificationTime(), DESIGN_BLOCK_IO::GetLibraryTimestamp(), FP_CACHE::GetTimestamp(), GPCB_FPL_CACHE::GetTimestamp(), SCH_IO_LIB_CACHE::IsFileChanged(), and SCH_IO_KICAD_LEGACY_LIB_CACHE::Save().