Stroika Library 3.0d16
 
Loading...
Searching...
No Matches
PathName.h
Go to the documentation of this file.
1/*
2 * Copyright(c) Sophist Solutions, Inc. 1990-2025. All rights reserved
3 */
4#ifndef _Stroika_Foundation_IO_FileSystem_PathName_h_
5#define _Stroika_Foundation_IO_FileSystem_PathName_h_ 1
6
7#include "Stroika/Foundation/StroikaPreComp.h"
8
9#include <filesystem>
10
12#include "Stroika/Foundation/Common/Common.h"
13#include "Stroika/Foundation/IO/FileSystem/Common.h"
14
15/**
16 * \file
17 *
18 * \note Code-Status: <a href="Code-Status.md#Alpha">Alpha</a>
19 *
20 * TODO:
21 *
22 * @todo See Stroika 1.0. It has some stuff about breaking paths into components. I'm not sure I like that design -but its woth looking
23 * at more closely. We need something like that here.
24 * -- LGP 2011-09-29
25 *
26 *
27 */
28
30
31 using Characters::String;
32
33 [[deprecated ("Since Stroika v3.0d12 use path::preferred_separator ")]] constexpr wchar_t kPathComponentSeperator = filesystem::path::preferred_separator;
34
35 /**
36 * This function presumes its argument is a directory, and makes sure it has a filesystem::path::preferred_separator character
37 * at the end. Use this when given a directory from some source that isn't so careful, so code can generally
38 * operate with the assumption that directories have that trailing slash, so its easier to compose
39 * pathnames.
40 */
41 String AssureDirectoryPathSlashTerminated (const String& dirPath);
42
43 /**
44 * Map ALL characters in the string to something safe to use for a filename. This
45 * gets rid of { ':', '/', '\', and '.' }
46 *
47 * @todo - consider having optional parameter to specify which characters get mapped, and how.
48 * maybe static const Mapping<Character,String> kDefaultSafeFilenmaeCharsMapping = {{':', " ", etc...}).
49 */
50 String SafeFilenameChars (const String& s);
51
52 /**
53 * if Win32 'short-file-name' - 8.3 - extend and return associated longfilename
54 */
55 String AssureLongFileName (const String& fileName);
56
57}
58
59/*
60 ********************************************************************************
61 ***************************** Implementation Details ***************************
62 ********************************************************************************
63 */
64#include "PathName.inl"
65
66#endif /*_Stroika_Foundation_IO_FileSystem_PathName_h_*/
String SafeFilenameChars(const String &s)
Definition PathName.cpp:48
String AssureLongFileName(const String &fileName)
Definition PathName.cpp:77
String AssureDirectoryPathSlashTerminated(const String &dirPath)
Definition PathName.cpp:24