bool copy(const String &isource, const String &idest, bool stopOnError) { String source = filepath::absolute(isource, true); String dest = filepath::absolute(idest, true); if (dest.back() == '/') { dest += filepath::lastComponent(source); } else if (isdir(dest) && filepath::lastComponent(source) != filepath::lastComponent(dest)) { dest += "/" + filepath::lastComponent(source); } if (!isdir(source)) { return performCopy(source, dest); } else { return ftw_b(source, [source, dest, stopOnError] (const String &path, bool isFile) -> bool { if (!isFile) { if (path == source) { mkdir(filepath::replace(path, source, dest)); return true; } bool ret = mkdir(filepath::replace(path, source, dest)); if (stopOnError) { return ret; } else { return true; } } else { bool ret = performCopy(path, filepath::replace(path, source, dest)); if (stopOnError) { return ret; } else { return true; } } }, -1, true); } }
//----------------------------------------------------------------------------// bool Editbox::performCut(Clipboard& clipboard) { if (isReadOnly()) return false; if (!performCopy(clipboard)) return false; handleDelete(); return true; }
bool SetBrushFaceAttributesTool::doMouseDoubleClick(const InputState& inputState) { return performCopy(inputState, true); }