mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-02 09:52:27 -04:00
*** empty log message ***
This commit is contained in:
parent
117fa0038c
commit
8ff24f8f4f
@ -810,6 +810,31 @@ rename_to(const Filename &other) const {
|
|||||||
other.to_os_specific().c_str()) == 0);
|
other.to_os_specific().c_str()) == 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
// Function: Filename::mkdir
|
||||||
|
// Access: Public
|
||||||
|
// Description: Creates all the directories in the path to the file
|
||||||
|
// specified in the filename (useful for writing).
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
bool Filename::
|
||||||
|
make_dir() const {
|
||||||
|
size_t p = 0;
|
||||||
|
while (p < _filename.length()) {
|
||||||
|
size_t slash = _filename.find('/', p);
|
||||||
|
if (slash != string::npos) {
|
||||||
|
string component = _filename.substr(0, slash);
|
||||||
|
if (!(component == ".") ||
|
||||||
|
!(component == "..")) {
|
||||||
|
mkdir(component.c_str(), 0xffff);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
p = slash;
|
||||||
|
while (p < _filename.length() && _filename[p] == '/')
|
||||||
|
p++;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
// Function: Filename::locate_basename
|
// Function: Filename::locate_basename
|
||||||
|
@ -134,6 +134,8 @@ public:
|
|||||||
bool unlink() const;
|
bool unlink() const;
|
||||||
bool rename_to(const Filename &other) const;
|
bool rename_to(const Filename &other) const;
|
||||||
|
|
||||||
|
bool make_dir() const;
|
||||||
|
|
||||||
// Comparison operators are handy.
|
// Comparison operators are handy.
|
||||||
INLINE bool operator == (const string &other) const;
|
INLINE bool operator == (const string &other) const;
|
||||||
INLINE bool operator != (const string &other) const;
|
INLINE bool operator != (const string &other) const;
|
||||||
|
@ -236,6 +236,7 @@ bool Multifile::Memfile::
|
|||||||
write(void) {
|
write(void) {
|
||||||
ofstream write_stream;
|
ofstream write_stream;
|
||||||
_name.set_binary();
|
_name.set_binary();
|
||||||
|
_name.make_dir();
|
||||||
if (!_name.open_write(write_stream)) {
|
if (!_name.open_write(write_stream)) {
|
||||||
express_cat.error()
|
express_cat.error()
|
||||||
<< "Multifile::Memfile::write() - Failed to open output file: "
|
<< "Multifile::Memfile::write() - Failed to open output file: "
|
||||||
@ -287,6 +288,7 @@ write(char *&start, int &size) {
|
|||||||
// Try to open the file for writing
|
// Try to open the file for writing
|
||||||
if (_file_open == false) {
|
if (_file_open == false) {
|
||||||
_name.set_binary();
|
_name.set_binary();
|
||||||
|
_name.make_dir();
|
||||||
if ((_file_open = _name.open_write(_write_stream)) == false) {
|
if ((_file_open = _name.open_write(_write_stream)) == false) {
|
||||||
express_cat.error()
|
express_cat.error()
|
||||||
<< "Multfile::Memfile::write() - Couldn't open file: "
|
<< "Multfile::Memfile::write() - Couldn't open file: "
|
||||||
|
Loading…
x
Reference in New Issue
Block a user