mirror of https://github.com/KLayout/klayout.git
Merge branch 'wip'
This commit is contained in:
commit
82fe920ac9
|
|
@ -281,18 +281,18 @@ MacroCollection::add_folder (const std::string &description, const std::string &
|
|||
if (! force_create) {
|
||||
|
||||
if (tl::verbosity () >= 20) {
|
||||
tl::log << "Folder does not exist - skipping: " << fp;
|
||||
tl::log << tl::to_string (tr ("Folder does not exist - skipping: ")) << fp;
|
||||
}
|
||||
return 0;
|
||||
|
||||
} else {
|
||||
|
||||
if (tl::verbosity () >= 20) {
|
||||
tl::log << "Folder does not exist yet - trying to create it: " << fp;
|
||||
tl::log << tl::to_string (tr ("Folder does not exist yet - trying to create it: ")) << fp;
|
||||
}
|
||||
if (! tl::mkpath (fp)) {
|
||||
if (tl::verbosity () >= 10) {
|
||||
tl::error << "Unable to create folder path: " << fp;
|
||||
if (tl::verbosity () >= 20) {
|
||||
tl::error << tl::to_string (tr ("Unable to create folder path: ")) << fp;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -301,8 +301,8 @@ MacroCollection::add_folder (const std::string &description, const std::string &
|
|||
}
|
||||
|
||||
if (! tl::is_dir (fp)) {
|
||||
if (tl::verbosity () >= 10) {
|
||||
tl::error << "Folder is not a directory: " << fp;
|
||||
if (tl::verbosity () >= 20) {
|
||||
tl::error << tl::to_string (tr ("Folder is not a directory - skipping: ")) << fp;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -317,7 +317,7 @@ MacroCollection::add_folder (const std::string &description, const std::string &
|
|||
if (! readonly && ! tl::is_writable (fp)) {
|
||||
readonly = true;
|
||||
if (tl::verbosity () >= 20) {
|
||||
tl::log << "Folder is read-only: " << fp;
|
||||
tl::log << tl::to_string (tr ("Folder is read-only: ")) << fp;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -368,7 +368,7 @@ void MacroCollection::scan ()
|
|||
std::string p = path ();
|
||||
|
||||
if (tl::verbosity () >= 20) {
|
||||
tl::info << "Scanning macro path " << p << " (readonly=" << m_readonly << ")";
|
||||
tl::info << tl::to_string (tr ("Scanning macro path ")) << p << " (readonly=" << m_readonly << ")";
|
||||
}
|
||||
|
||||
if (! p.empty () && p[0] == ':') {
|
||||
|
|
@ -501,7 +501,7 @@ MacroCollection::create_entry (const std::string &path)
|
|||
}
|
||||
|
||||
} catch (tl::Exception &ex) {
|
||||
tl::error << "Reading " << path << ": " << ex.msg ();
|
||||
tl::error << tl::to_string (tr ("Reading ")) << path << ": " << ex.msg ();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -578,7 +578,7 @@ void MacroCollection::save ()
|
|||
bool MacroCollection::rename (const std::string &n)
|
||||
{
|
||||
if (tl::verbosity () >= 20) {
|
||||
tl::info << "Renaming macro folder " << path () << " to " << n;
|
||||
tl::info << tl::to_string (tr ("Renaming macro folder ")) << path () << " to " << n;
|
||||
}
|
||||
begin_changes ();
|
||||
if (! tl::rename_file (path (), n)) {
|
||||
|
|
|
|||
|
|
@ -27,6 +27,9 @@
|
|||
|
||||
#include <cctype>
|
||||
|
||||
// Use this define to print debug output
|
||||
// #define FILE_UTILS_VERBOSE
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
|
||||
# include <sys/types.h>
|
||||
|
|
@ -448,7 +451,9 @@ bool mkpath (const std::string &p)
|
|||
front += parts[i++];
|
||||
if (! file_exists (front)) {
|
||||
if (! mkdir (front)) {
|
||||
#if defined(FILE_UTILS_VERBOSE)
|
||||
tl::error << tr ("Unable to create directory: ") << front;
|
||||
#endif
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
@ -511,13 +516,17 @@ bool rm_dir_recursive (const std::string &p)
|
|||
for (std::vector<std::string>::const_iterator e = entries.begin (); e != entries.end (); ++e) {
|
||||
std::string tc = tl::combine_path (path, *e);
|
||||
if (! rm_file (tc)) {
|
||||
#if defined(FILE_UTILS_VERBOSE)
|
||||
tl::error << tr ("Unable to remove file: ") << tc;
|
||||
#endif
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (! rm_dir (path)) {
|
||||
#if defined(FILE_UTILS_VERBOSE)
|
||||
tl::error << tr ("Unable to remove directory: ") << path;
|
||||
#endif
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
@ -535,7 +544,9 @@ cp_dir_recursive (const std::string &source, const std::string &target)
|
|||
for (std::vector<std::string>::const_iterator e = entries.begin (); e != entries.end (); ++e) {
|
||||
std::string tc = tl::combine_path (path_to, *e);
|
||||
if (! mkpath (tc)) {
|
||||
#if defined(FILE_UTILS_VERBOSE)
|
||||
tl::error << tr ("Unable to create target directory: ") << tc;
|
||||
#endif
|
||||
return false;
|
||||
}
|
||||
if (! cp_dir_recursive (tl::combine_path (path, *e), tc)) {
|
||||
|
|
@ -558,8 +569,10 @@ cp_dir_recursive (const std::string &source, const std::string &target)
|
|||
is.copy_to (os);
|
||||
|
||||
} catch (tl::Exception &ex) {
|
||||
#if defined(FILE_UTILS_VERBOSE)
|
||||
tl::error << tr ("Unable to copy file ") << tl::combine_path (path_to, *e) << tr (" to ") << tl::combine_path (path, *e)
|
||||
<< tr ("(Error ") << ex.msg () << ")";
|
||||
#endif
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue