62 INLINE
Filename(
const char *filename);
63 INLINE
Filename(
const std::string &filename);
64 INLINE
Filename(
const std::wstring &filename);
66 INLINE
Filename(std::string &&filename)
noexcept;
76 EXTENSION(PyObject *__reduce__(PyObject *self)
const);
83 INLINE
static Filename text_filename(
const std::string &filename);
85 INLINE
static Filename binary_filename(
const std::string &filename);
86 INLINE
static Filename dso_filename(
const std::string &filename);
87 INLINE
static Filename executable_filename(
const std::string &filename);
89 INLINE
static Filename pattern_filename(
const std::string &filename);
91 static Filename from_os_specific(
const std::string &os_specific,
92 Type type = T_general);
93 static Filename from_os_specific_w(
const std::wstring &os_specific,
94 Type type = T_general);
95 static Filename expand_from(
const std::string &user_string,
96 Type type = T_general);
97 static Filename temporary(
const std::string &dirname,
const std::string &prefix,
98 const std::string &suffix = std::string(),
99 Type type = T_general);
101 static const Filename &get_home_directory();
102 static const Filename &get_temp_directory();
103 static const Filename &get_user_appdata_directory();
104 static const Filename &get_common_appdata_directory();
107 INLINE
Filename &operator = (
const std::string &filename);
108 INLINE
Filename &operator = (
const std::wstring &filename);
109 INLINE
Filename &operator = (
const char *filename);
111 INLINE
Filename &operator = (std::string &&filename)
noexcept;
115 INLINE
operator const std::string & ()
const;
116 INLINE
const char *c_str()
const;
117 INLINE
bool empty()
const;
118 INLINE
size_t length()
const;
119 INLINE
char operator [] (
size_t n)
const;
121 EXTENSION(PyObject *__repr__()
const);
122 EXTENSION(PyObject *__fspath__()
const);
124 INLINE std::string substr(
size_t begin)
const;
125 INLINE std::string substr(
size_t begin,
size_t end)
const;
126 INLINE
void operator += (
const std::string &other);
127 INLINE
Filename operator + (
const std::string &other)
const;
133 INLINE std::string get_fullpath()
const;
134 INLINE std::wstring get_fullpath_w()
const;
135 INLINE std::string get_dirname()
const;
136 INLINE std::string get_basename()
const;
137 INLINE std::string get_fullpath_wo_extension()
const;
138 INLINE std::string get_basename_wo_extension()
const;
139 INLINE std::string get_extension()
const;
142 void set_fullpath(
const std::string &s);
143 void set_dirname(
const std::string &s);
144 void set_basename(
const std::string &s);
145 void set_fullpath_wo_extension(
const std::string &s);
146 void set_basename_wo_extension(
const std::string &s);
147 void set_extension(
const std::string &s);
153 INLINE
void set_binary();
154 INLINE
void set_text();
155 INLINE
bool is_binary()
const;
156 INLINE
bool is_text()
const;
157 INLINE
bool is_binary_or_text()
const;
159 INLINE
void set_type(Type type);
160 INLINE Type get_type()
const;
162 INLINE
void set_pattern(
bool pattern);
163 INLINE
bool get_pattern()
const;
165 INLINE
bool has_hash()
const;
166 Filename get_filename_index(
int index)
const;
168 INLINE std::string get_hash_to_end()
const;
169 void set_hash_to_end(
const std::string &s);
171 void extract_components(vector_string &components)
const;
176 INLINE
bool is_local()
const;
177 INLINE
bool is_fully_qualified()
const;
178 void make_absolute();
179 void make_absolute(
const Filename &start_directory);
181 bool make_canonical();
182 bool make_true_case();
184 std::string to_os_specific()
const;
185 std::wstring to_os_specific_w()
const;
186 std::string to_os_generic()
const;
187 std::string to_os_short_name()
const;
188 std::string to_os_long_name()
const;
191 bool is_regular_file()
const;
192 bool is_writable()
const;
193 bool is_directory()
const;
194 bool is_executable()
const;
195 int compare_timestamps(
const Filename &other,
196 bool this_missing_is_old =
true,
197 bool other_missing_is_old =
true)
const;
198 time_t get_timestamp()
const;
199 time_t get_access_timestamp()
const;
200 std::streamsize get_file_size()
const;
202 bool resolve_filename(
const DSearchPath &searchpath,
203 const std::string &default_extension = std::string());
204 bool make_relative_to(
Filename directory,
bool allow_backups =
true);
205 int find_on_searchpath(
const DSearchPath &searchpath);
207 bool scan_directory(vector_string &contents)
const;
209 EXTENSION(PyObject *scan_directory()
const);
212 bool open_read(std::ifstream &stream)
const;
213 bool open_write(std::ofstream &stream,
bool truncate =
true)
const;
214 bool open_append(std::ofstream &stream)
const;
215 bool open_read_write(std::fstream &stream,
bool truncate =
false)
const;
216 bool open_read_append(std::fstream &stream)
const;
218#ifdef USE_PANDAFILESTREAM
219 bool open_read(pifstream &stream)
const;
220 bool open_write(pofstream &stream,
bool truncate =
true)
const;
221 bool open_append(pofstream &stream)
const;
222 bool open_read_write(pfstream &stream,
bool truncate =
false)
const;
223 bool open_read_append(pfstream &stream)
const;
229 BLOCKING
bool rename_to(
const Filename &other)
const;
230 BLOCKING
bool copy_to(
const Filename &other)
const;
232 bool make_dir()
const;
237 INLINE
bool operator == (
const std::string &other)
const;
238 INLINE
bool operator != (
const std::string &other)
const;
239 INLINE
bool operator < (
const std::string &other)
const;
241 INLINE
bool __nonzero__()
const;
242 int get_hash()
const;
244 INLINE
void output(std::ostream &out)
const;
246 INLINE
static void set_filesystem_encoding(TextEncoder::Encoding encoding);
247 INLINE
static TextEncoder::Encoding get_filesystem_encoding();
250 bool atomic_compare_and_exchange_contents(std::string &orig_contents,
const std::string &old_contents,
const std::string &new_contents)
const;
251 bool atomic_read_contents(std::string &contents)
const;
254 void locate_basename();
255 void locate_extension();
257 size_t get_common_prefix(
const std::string &other)
const;
258 static int count_slashes(
const std::string &str);
259 bool r_make_canonical(
const Filename &cwd);
261 std::string _filename;
265 size_t _basename_start;
266 size_t _basename_end;
267 size_t _extension_start;
273 static TextEncoder::Encoding _filesystem_encoding;
274 static TVOLATILE AtomicAdjust::Pointer _home_directory;
275 static TVOLATILE AtomicAdjust::Pointer _temp_directory;
276 static TVOLATILE AtomicAdjust::Pointer _user_appdata_directory;
277 static TVOLATILE AtomicAdjust::Pointer _common_appdata_directory;
281 static std::string _internal_data_dir;
288 static void init_type() {
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.