From b06643e9b161758e4dda2705d332844bc35bb551 Mon Sep 17 00:00:00 2001 From: David Rose Date: Mon, 12 Jun 2006 18:19:12 +0000 Subject: [PATCH] fix make_dir when filename ends in '/.' --- dtool/src/dtoolutil/filename.cxx | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/dtool/src/dtoolutil/filename.cxx b/dtool/src/dtoolutil/filename.cxx index 3df4036540..544474876c 100644 --- a/dtool/src/dtoolutil/filename.cxx +++ b/dtool/src/dtoolutil/filename.cxx @@ -1836,18 +1836,19 @@ make_dir() const { if (empty()) { return false; } - Filename path = *this; - path.standardize(); - string dirname; + Filename path; if (_filename[_filename.length() - 1] == '/') { // The Filename ends in a slash; it represents a directory. - dirname = path.get_fullpath(); + path = (*this); } else { // The Filename does not end in a slash; it represents a file. - dirname = path.get_dirname(); + path = get_dirname(); } + path.standardize(); + string dirname = path.get_fullpath(); + // First, make sure everything up to the last path is known. We // don't care too much if any of these fail; maybe they failed // because the directory was already there.