Stroika Library 3.0d16
 
Loading...
Searching...
No Matches
Stroika::Foundation::IO::FileSystem Namespace Reference

Namespaces

namespace  WellKnownLocations
 

Classes

class  AppTmpFileManager
 
class  DirectoryIterable
 
class  DirectoryIterator
 
struct  DiskInfoType
 
class  Exception
 
class  MemoryMappedFileReader
 
struct  MountedFilesystemType
 
class  Ptr
 
class  ScopedTmpDir
 
class  ScopedTmpFile
 
class  ThroughTmpFileWriter
 utility to atomically update/write a file. More...
 

Typedefs

using FileOffset_t = int64_t
 

Enumerations

enum class  BlockDeviceKind {
  eRemovableDisk , eLocalDisk , eNetworkDrive , eTemporaryFiles ,
  eReadOnlyEjectable , eSystemInformation , Stroika_Define_Enum_Bounds =(eRemovableDisk, eSystemInformation)
}
 

Functions

Containers::KeyedCollection< DiskInfoType, filesystem::path > GetAvailableDisks ()
 
Ptr Default ()
 
String GetVolumeName (const filesystem::path &driveLetterAbsPath)
 
Containers::KeyedCollection< MountedFilesystemType, filesystem::path > GetMountedFilesystems ()
 
String AssureDirectoryPathSlashTerminated (const String &dirPath)
 
String SafeFilenameChars (const String &s)
 
String AssureLongFileName (const String &fileName)
 
filesystem::path CreateTmpFile (const String &baseName)
 

Detailed Description

TODO:

Note
Code-Status: Beta

TODO:

     o   This file is obsolete, and will be gradually replaced - moving its contents out to other modules

TODO:

Typedef Documentation

◆ FileOffset_t

Definition at line 28 of file Foundation/IO/FileSystem/Common.h.

Enumeration Type Documentation

◆ BlockDeviceKind

Note
Common::DefaultNames<> supported
These print names are mostly for display and debugging purposes, and they are not guaranteed to be safe for persistence (so be sure to version).
Enumerator
eRemovableDisk 

On Windoze, corresponds to https://msdn.microsoft.com/en-us/library/aa394173%28v=vs.85%29.aspx?f=255&MSPPError=-2147217396 "Removable Disk" or https://msdn.microsoft.com/en-us/library/windows/desktop/aa364939%28v=vs.85%29.aspx DRIVE_REMOVABLE

eLocalDisk 

On Windoze, corresponds to https://msdn.microsoft.com/en-us/library/aa394173%28v=vs.85%29.aspx?f=255&MSPPError=-2147217396 "Local Disk" or https://msdn.microsoft.com/en-us/library/windows/desktop/aa364939%28v=vs.85%29.aspx DRIVE_FIXED

eNetworkDrive 

On Windoze, corresponds to https://msdn.microsoft.com/en-us/library/aa394173%28v=vs.85%29.aspx?f=255&MSPPError=-2147217396 "Network Drive" or https://msdn.microsoft.com/en-us/library/windows/desktop/aa364939%28v=vs.85%29.aspx DRIVE_REMOTE

eTemporaryFiles 

On Windoze, corresponds to https://msdn.microsoft.com/en-us/library/aa394173%28v=vs.85%29.aspx?f=255&MSPPError=-2147217396 "RAM Disk" or https://msdn.microsoft.com/en-us/library/windows/desktop/aa364939%28v=vs.85%29.aspx DRIVE_RAMDISK On Linux, this is tmpfs

eReadOnlyEjectable 

On Windoze, corresponds to https://msdn.microsoft.com/en-us/library/aa394173%28v=vs.85%29.aspx?f=255&MSPPError=-2147217396 "Compact Disc" or https://msdn.microsoft.com/en-us/library/windows/desktop/aa364939%28v=vs.85%29.aspx DRIVE_CDROM

eSystemInformation 

e.g. Linux procfs

Definition at line 39 of file Disk.h.

Function Documentation

◆ GetAvailableDisks()

KeyedCollection< DiskInfoType, filesystem::path > Stroika::Foundation::IO::FileSystem::GetAvailableDisks ( )

Fetch all the available disks (DiskInfoType) installed on the system, keyed by fDeviceName

Definition at line 222 of file Disk.cpp.

◆ Default()

IO::FileSystem::Ptr Stroika::Foundation::IO::FileSystem::Default ( )
Note
Design Note: why method 'Default ()' instead of just sThe, or something like that? There is one special interesting filesystem, but the intention was to someday allow different filesystems to be accessed. For example, treating a zipfile as a filesystem.

Definition at line 153 of file Foundation/IO/FileSystem/Filesystem.cpp.

◆ GetVolumeName()

String Stroika::Foundation::IO::FileSystem::GetVolumeName ( const filesystem::path &  driveLetterAbsPath)

Possibly useful, even after using std::filesystem, as I dont think supported in std::filesystem. but

Definition at line 199 of file FileUtils.cpp.

◆ GetMountedFilesystems()

Containers::KeyedCollection< MountedFilesystemType, filesystem::path > Stroika::Foundation::IO::FileSystem::GetMountedFilesystems ( )

Fetch all the mounted filesystems on this computer. Somewhat analagous to the UNIX 'df' command, or cat /etc/mtab

Definition at line 318 of file MountedFilesystem.cpp.

◆ AssureDirectoryPathSlashTerminated()

String Stroika::Foundation::IO::FileSystem::AssureDirectoryPathSlashTerminated ( const String dirPath)

This function presumes its argument is a directory, and makes sure it has a filesystem::path::preferred_separator character at the end. Use this when given a directory from some source that isn't so careful, so code can generally operate with the assumption that directories have that trailing slash, so its easier to compose pathnames.

Definition at line 24 of file PathName.cpp.

◆ SafeFilenameChars()

String Stroika::Foundation::IO::FileSystem::SafeFilenameChars ( const String s)

Map ALL characters in the string to something safe to use for a filename. This gets rid of { ':', '/', '\', and '.' }

@todo - consider having optional parameter to specify which characters get mapped, and how.
        maybe static const Mapping<Character,String> kDefaultSafeFilenmaeCharsMapping = {{':', " ", etc...}). 

Definition at line 48 of file PathName.cpp.

◆ AssureLongFileName()

String Stroika::Foundation::IO::FileSystem::AssureLongFileName ( const String fileName)

if Win32 'short-file-name' - 8.3 - extend and return associated longfilename

Definition at line 77 of file PathName.cpp.

◆ CreateTmpFile()

filesystem::path Stroika::Foundation::IO::FileSystem::CreateTmpFile ( const String baseName)

Creates an empty file with a random/unique name (based on baseName) in inFolder (or if not specified, in the WellKnownLocations::GetTemporary () directory) and returns that filename. These files are NOT automatically cleaned up by Stroika (for that see ScopedTmpFile).

Note
caller must assure 'inFolder' exists and is writeable'

require root_path is empty - just filename and possibly extention. If extension missing, maybe added automatically

Note
this actually creates (an empty) file

Definition at line 195 of file TemporaryFile.cpp.