Bool BonkEnc::CDDBBatch::SaveEntries() { // Save queued queries if (queries.Length() == 0) { // Delete queries file if no more saved queries exist File(String(config->configDir).Append("cddb\\queries.xml")).Delete(); } else { Directory(String(config->configDir).Append("cddb")).Create(); XML::Document *document = new XML::Document(); XML::Node *root = new XML::Node("cddbQueries"); document->SetRootNode(root); for (Int i = 0; i < queries.Length(); i++) { root->AddNode("query", queries.GetNth(i)); } document->SaveFile(String(config->configDir).Append("cddb\\queries.xml")); delete document; delete root; } // Save queued submits if (submits.Length() == 0) { // Delete submits file if no more saved submits exist File(String(config->configDir).Append("cddb\\submits.xml")).Delete(); } else { Directory(String(config->configDir).Append("cddb")).Create(); XML::Document *document = new XML::Document(); XML::Node *root = new XML::Node("cddbSubmits"); document->SetRootNode(root); for (Int i = 0; i < submits.Length(); i++) { XML::Node *node = root->AddNode("submit", submits.GetNth(i).DiscIDToString()); node->SetAttribute("category", submits.GetNth(i).category); } document->SaveFile(String(config->configDir).Append("cddb\\submits.xml")); delete document; delete root; } return True; }
void FileFS::create_subfolders(const std::string &loc) { bfs::path data("data"); bfs::path metadata("metadata"); bfs::path p; p = bfs::canonical(loc); data_dir = Directory(p / data, mode); metadata_dir = Directory(p / metadata, mode); }
QList<Directory> PlatformMac::getDefaultCatalogDirectories() { QList<Directory> list; QStringList types; types << "*.app"; list.append(Directory("/Applications", types, false, false, 5)); list.append(Directory("~/Applications", types, false, false, 5)); list.append(Directory("/System/Library/CoreServices", types, false, false, 5)); list.append(Directory("~", QStringList(), true, false, 0)); return list; }
void nix::file::BlockFS::createSubFolders(const std::shared_ptr<base::IFile> &file) { bfs::path data_arrays("data_arrays"); bfs::path tags("tags"); bfs::path multi_tags("multi_tags"); bfs::path sources("sources"); bfs::path p(location()); bfs::path groups("groups"); data_array_dir = Directory(p / data_arrays, file->fileMode()); tag_dir = Directory(p / tags, file->fileMode()); multi_tag_dir = Directory(p / multi_tags, file->fileMode()); source_dir = Directory(p / sources, file->fileMode()); group_dir = Directory(p / groups, file->fileMode()); }
void Format(){ Install(); for (int i = 0; i < DATADISTRICTION_MAXSIZE; i++) data[i] = '#'; int inode_num_tmp = GetNextInodeNum(); //分配inode int block_num_tmp = GetNextBlockNum(); //分配block inode[inode_num_tmp].CreateInode(inode_num_tmp,1,ROOT,DIRFILE,"rrrrrrrrr"); //在inode节点表中添加新项 inode[inode_num_tmp].i_zone[0] = block_num_tmp; //inode指向物理块 Directory root = Directory(); writeInBlock(block_num_tmp, (char*)&root); //此时目录对应的物理块的表为空 strcpy(superblock_mem.CurDir, "/"); //当前目录为根 superblock_mem.curind = inode_num_tmp; //得到当前目录对应的inode编号 //用户1 char user1name[16] = "PNT"; strcpy(superblock_mem.username[0], user1name); strcpy(superblock_mem.password[0], "PNT"); MKDIR(user1name); //在当前目录(/)下创建用户1 //用户2 char user2name[16] = "user2"; strcpy(superblock_mem.username[1], user2name); strcpy(superblock_mem.password[1], "user2"); MKDIR(user2name); //在当前目录(/)下创建用户2 //用户3 char user3name[16] = "user3"; strcpy(superblock_mem.username[2], user3name); strcpy(superblock_mem.password[2], "user3"); MKDIR(user3name); //在当前目录(/)下创建用户3 }
Directory Directory::up() const { if( toString().empty() ) return Directory(); Path pathToAny = removeEndSlash(); std::string::size_type index = pathToAny.toString().find_last_of( "/" ); if( index != std::string::npos ) { return Path( pathToAny.toString().substr( 0, index ) ); } _CAESARIA_DEBUG_BREAK_IF( !exist() ); return Directory(); }
HashExtensible::HashExtensible(std::string filename, int bucketCap) { this->bucketCapacity=bucketCap; this->filename=filename; ifstream file(filename.c_str()); if (file.is_open()) { file.close(); load(); } else { ofstream ofile(filename.c_str(),ios::trunc); ofile.close(); } this->buckets= Buckets(this->bucketCapacity); this->directory= Directory(); this->actualbits=directory.getActualBits(); save(); }
TEST(findCompileArgsInJsonDatabase, ReadsSingleEntry) { StringRef Directory("/some/directory"); StringRef FileName("/path/to/a-file.cpp"); StringRef Command("/path/to/compiler and some arguments"); std::string ErrorMessage; CompileCommand FoundCommand = findCompileArgsInJsonDatabase( FileName, ("[{\"directory\":\"" + Directory + "\"," + "\"command\":\"" + Command + "\"," "\"file\":\"" + FileName + "\"}]").str(), ErrorMessage); EXPECT_EQ(Directory, FoundCommand.Directory) << ErrorMessage; ASSERT_EQ(4u, FoundCommand.CommandLine.size()) << ErrorMessage; EXPECT_EQ("/path/to/compiler", FoundCommand.CommandLine[0]) << ErrorMessage; EXPECT_EQ("and", FoundCommand.CommandLine[1]) << ErrorMessage; EXPECT_EQ("some", FoundCommand.CommandLine[2]) << ErrorMessage; EXPECT_EQ("arguments", FoundCommand.CommandLine[3]) << ErrorMessage; CompileCommand NotFound = findCompileArgsInJsonDatabase( "a-file.cpp", ("[{\"directory\":\"" + Directory + "\"," + "\"command\":\"" + Command + "\"," "\"file\":\"" + FileName + "\"}]").str(), ErrorMessage); EXPECT_TRUE(NotFound.Directory.empty()) << ErrorMessage; EXPECT_TRUE(NotFound.CommandLine.empty()) << ErrorMessage; }
void Aggregate::merger() { // Just sleep for a while // Only for syncronization in main loop boost::this_thread::sleep(boost::posix_time::millisec(500)); // If total size downloaded isn't equal // to the size of file downloaded then // do not merge the Chunks if( m_filesize != bytesTotal()) Throw(ex::Error,"Downloaded bytes greater than total filesize."); fancyprint("Merging!",NOTIFY); fancyprint("Do not close this window.",WARNING); File tmp(tempName()); tmp.write(Node::FORCE); // TODO try binary appends and storing to "tmp" // Append the content to "tmp" for(unsigned i=0; i < m_chunk.size(); i++){ print(i+1 << " of " << m_chunk.size()); tmp.append(*(m_chunk[i]->file())); std::cout << DELETE; } std::cout << DELETE; tmp.move(prettyName(),Node::NEW); // Remove the old directory Directory(m_hashedUrl).remove(Node::FORCE); fancyprint("Complete!",SUCCESS); }
std::vector<Directory> Directory::listDirectories() const { std::vector<Directory> directories; DIR* directory = opendir(mCurrentPath.c_str()); if (directory == nullptr) return directories; struct dirent* entry; std::string entryPath; while ((entry = readdir(directory)) != nullptr) { entryPath = mCurrentPath; entryPath.append("/").append(entry->d_name); struct stat fileInfo; if (lstat(entryPath.c_str(), &fileInfo) == 0 && S_ISDIR(fileInfo.st_mode)) { directories.push_back(Directory(entryPath)); } } closedir(directory); std::sort( directories.begin(), directories.end(), [](Directory const& lhs, Directory const& rhs) { return lhs.getCurrentPath() < rhs.getCurrentPath(); } ); return directories; }
void FileSourceZip::AddFile(const std::string &path, const FileStat &fileStat) { std::vector<std::string> fragments; SplitPath(path, fragments); assert(fragments.size() > 0); Directory *dir = &m_root; if (fragments.size() > 1) { std::string fullPath; for (unsigned int i = 0; i < fragments.size()-1; i++) { fullPath += ((i > 0) ? "/" : "") + fragments[i]; std::map<std::string,FileStat>::const_iterator it = dir->files.find(fragments[i]); if (it == dir->files.end()) dir->files.insert(std::make_pair(fragments[i], FileStat(Uint32(-1), 0, MakeFileInfo(fullPath, FileInfo::FT_DIR)))); dir = &(dir->subdirs[fragments[i]]); } } const std::string &filename = fragments.back(); if (fileStat.info.IsDir()) dir->subdirs.insert(std::make_pair(filename, Directory())); dir->files.insert(std::make_pair(filename, fileStat)); }
ArrayList<Directory> Directory::getDirectories() const throw() { ArrayList<STLString> pathList; FileImplementation::getFileList(mPath, pathList); ArrayList<Directory> directories(DEFAULT_ALLOCATOR, pathList.size()); for(const STLString& path : pathList) if(FileImplementation::getAttributes(path) & FileImplementation::FLAG_DIRECTORY) { directories.pushBack(Directory(path)); } return directories; }
CString COXUNC::GetAbbreviation(int nMaxLength, BOOL bAtLeastFile /* = TRUE */) const // See also the MFC function AbbreviateName() in filelist.cpp { CString sUNC = Full(); CString sServer; CString sShare; CString sDirectory; CString sFile; // If nMaxLength is more than enough to hold the full UNC name, we're done. // This is probably a pretty common case, so we'll put it first. if (sUNC.GetLength() <= nMaxLength) return Full(); // If nMaxLength isn't enough to hold at least the filename, we're done sFile = File(); if (nMaxLength < sFile.GetLength()) { if (bAtLeastFile) return sFile; else return _T(""); } // If nMaxLength isn't enough to hold at least <server><share>\...\<file>, the // result is the filename. sServer = Server(); sShare = Share(); sDirectory = Directory(); CString sAbbr = PreferedSlash() + CString(_T("...")) + PreferedSlash(); int nServerShareFileLength = sServer.GetLength() + sShare.GetLength() + sFile.GetLength(); if (nMaxLength < nServerShareFileLength + sAbbr.GetLength()) return sFile; // Now loop through the remaining directory components until something // of the form <server><share>\...\<one_or_more_dirs>\<file> fits. int nRemainingSpace = nMaxLength - nServerShareFileLength - sAbbr.GetLength(); ASSERT(0 <= nRemainingSpace); LPCTSTR pszStartDirectory = (LPCTSTR)sDirectory; LPCTSTR pszSearchDirectory = pszStartDirectory + sDirectory.GetLength(); LPCTSTR pszUsableDirectoryPart = pszSearchDirectory; // ... Add one to the remainings space for the directory // bacause we are counting the number of characters in the directory // but we will remove its leading slash (so one extra character is allowed) nRemainingSpace++; while ((pszStartDirectory < pszSearchDirectory) && (0 < nRemainingSpace)) { pszSearchDirectory--; nRemainingSpace--; if (_tcschr(m_pszSlashes, *pszSearchDirectory) != NULL) // ... Do not include the leading slash pszUsableDirectoryPart = pszSearchDirectory + 1; } return sServer + sShare + sAbbr + pszUsableDirectoryPart + sFile; }
void ImageList::AddToList(const GString Filename, const GString Prefix) { Directory ResFilename = Directory(Prefix) / Filename; ResFilename.Normalize(true); if (Images.find(ResFilename) == Images.end()) { ImageLoader::AddToPending(ResFilename.c_path()); Images[ResFilename] = nullptr; } }
void DirectoryCache::AddRoot( const char* path ) { for (int i = 0; i < m_Roots.size(); i++) { if (!stricmp( m_Roots[i].m_Path.c_str(), path )) { return; } } m_Roots.push_back( Directory( path, path ) ); UpdateCache(); }
std::vector<CacheManager::LoadedCacheInfo> CacheManager::cacheInformationFromDirectory( const Directory& dir) const { std::vector<LoadedCacheInfo> result; std::vector<std::string> directories = dir.readDirectories(false); for (const auto& directory : directories) { Directory d(directory); // Extract the name of the directory // +1 as the last path delimiter is missing from the path std::string directoryName = directory.substr(dir.path().size() + 1); std::vector<std::string> hashes = d.readDirectories(); for (const auto& hash : hashes) { // Extract the hash from the directory name // +1 as the last path delimiter is missing from the path std::string hashName = hash.substr(d.path().size() + 1); std::vector<std::string> files = Directory(hash).readFiles(); // Cache directories should only contain a single file with the // same name as the directory if (files.size() > 1) LERROR("Directory '" << hash << "' contained more than one file"); if (files.size() == 1) { // Extract the file name from the full path // +1 as the last path delimiter is missing from the path std::string filename = files[0].substr(Directory(hash).path().size() + 1); if (filename != directoryName) LERROR("File contained in cache directory '" << hash << "' contains a file with name '" << filename << "instead of the expected '" << directoryName << "'"); else // Adding the absPath to normalize all / and \ for Windows result.emplace_back(std::stoul(hashName), absPath(files[0])); } } } return result; }
void FixDirectories(void) { WriteTrace(TraceAppInit, TraceDebug, "Starting"); CPath Directory(g_Settings->LoadStringVal(Cmd_BaseDirectory).c_str(), ""); Directory.AppendDirectory("Config"); if (!Directory.DirectoryExists()) { WriteTrace(TraceAppInit, TraceDebug, "Creating %s", (const char *)Directory); Directory.DirectoryCreate(); } else { WriteTrace(TraceAppInit, TraceDebug, "%s already exists", (const char *)Directory); } Directory.UpDirectory(); Directory.AppendDirectory("Save"); if (!Directory.DirectoryExists()) { WriteTrace(TraceAppInit, TraceDebug, "Creating %s", (const char *)Directory); Directory.DirectoryCreate(); } else { WriteTrace(TraceAppInit, TraceDebug, "%s already exists", (const char *)Directory); } Directory.UpDirectory(); Directory.AppendDirectory("Screenshots"); if (!Directory.DirectoryExists()) { WriteTrace(TraceAppInit, TraceDebug, "Creating %s", (const char *)Directory); Directory.DirectoryCreate(); } else { WriteTrace(TraceAppInit, TraceDebug, "%s already exists", (const char *)Directory); } Directory.UpDirectory(); Directory.AppendDirectory("textures"); if (!Directory.DirectoryExists()) { WriteTrace(TraceAppInit, TraceDebug, "Creating %s", (const char *)Directory); Directory.DirectoryCreate(); } else { WriteTrace(TraceAppInit, TraceDebug, "%s already exists", (const char *)Directory); } WriteTrace(TraceAppInit, TraceDebug, "Done"); }
TEST(findCompileArgsInJsonDatabase, ReadsDirectoryWithSpaces) { StringRef Directory("/some directory / with spaces"); StringRef FileName("/path/to/a-file.cpp"); StringRef Command("a command"); std::string ErrorMessage; CompileCommand FoundCommand = findCompileArgsInJsonDatabase( FileName, ("[{\"directory\":\"" + Directory + "\"," + "\"command\":\"" + Command + "\"," "\"file\":\"" + FileName + "\"}]").str(), ErrorMessage); EXPECT_EQ(Directory, FoundCommand.Directory) << ErrorMessage; }
//--------------------------------------------------------- bool CWKSP_Project::Copy(void) { wxString FileName; if( !DLG_Save(FileName, ID_DLG_PROJECT_SAVE) ) { return( false ); } wxFileName Directory(FileName); Directory.AppendDir(Directory.GetFullName()); if( !Directory.DirExists() ) { Directory.Mkdir(wxS_DIR_DEFAULT, wxPATH_MKDIR_FULL); } size_t i, j; for(j=0; j<SG_Get_Data_Manager().Grid_System_Count(); j++) { for(i=0; i<SG_Get_Data_Manager().Get_Grid_System(j)->Count(); i++) { _Copy_To_File(g_pData->Get(SG_Get_Data_Manager().Get_Grid_System(j)->Get(i)), Directory.GetFullPath()); } } for(i=0; i<SG_Get_Data_Manager().Get_Point_Cloud()->Count(); i++) { _Copy_To_File(g_pData->Get(SG_Get_Data_Manager().Get_Point_Cloud()->Get(i)), Directory.GetFullPath()); } for(i=0; i<SG_Get_Data_Manager().Get_Shapes()->Count(); i++) { _Copy_To_File(g_pData->Get(SG_Get_Data_Manager().Get_Shapes()->Get(i)), Directory.GetFullPath()); } for(i=0; i<SG_Get_Data_Manager().Get_Table()->Count(); i++) { _Copy_To_File(g_pData->Get(SG_Get_Data_Manager().Get_Table()->Get(i)), Directory.GetFullPath()); } for(i=0; i<SG_Get_Data_Manager().asTIN()->Count(); i++) { _Copy_To_File(g_pData->Get(SG_Get_Data_Manager().asTIN()->Get(i)), Directory.GetFullPath()); } return( _Save(Directory.GetFullPath(), false, true) ); }
CString COXUNC::FileForm() const { CString sDir = Directory(); CString sFile = File(); if (sFile.IsEmpty() && (1 < sDir.GetLength())) { // ... Last character must be a slash ASSERT(_tcschr(m_pszSlashes, sDir[sDir.GetLength() - 1]) != NULL); // ... Remove it sDir = sDir.Left(sDir.GetLength() - 1); } CString sFileForm = Server() + Share() + sDir + sFile; return sFileForm; }
TEST(findCompileArgsInJsonDatabase, ReadsCompileCommandLinesWithSpaces) { StringRef Directory("/some/directory"); StringRef FileName("/path/to/a-file.cpp"); StringRef Command("\\\"/path to compiler\\\" \\\"and an argument\\\""); std::string ErrorMessage; CompileCommand FoundCommand = findCompileArgsInJsonDatabase( FileName, ("[{\"directory\":\"" + Directory + "\"," + "\"command\":\"" + Command + "\"," "\"file\":\"" + FileName + "\"}]").str(), ErrorMessage); ASSERT_EQ(2u, FoundCommand.CommandLine.size()); EXPECT_EQ("/path to compiler", FoundCommand.CommandLine[0]) << ErrorMessage; EXPECT_EQ("and an argument", FoundCommand.CommandLine[1]) << ErrorMessage; }
void ImageList::AddToListIndex(const GString Filename, const GString Prefix, int Index) { Directory ResFilename = Directory(Prefix) / Filename; ResFilename.Normalize(true); if (ImagesIndex.find(Index) == ImagesIndex.end()) { ImageLoader::AddToPending(ResFilename.c_path()); Images[ResFilename] = nullptr; ImagesIndex[Index] = nullptr; ImagesIndexPending[Index] = ResFilename; } }
void writedirItem(DirectoryItem* x, char* name){ //将新建的目录写入表项 int newid; newid = x->d_ino = GetNextInodeNum(); //获取inode编号 strcpy(x->d_name, name); //inode编号对应目录名 inode[newid].CreateInode(newid, 1, superblock_mem.curuserid, DIRFILE, "xxxxxxxx"); //创建新inode time_t ct; ct = time(NULL); inode[newid].file_ctime = ct; //创建时间 inode[newid].file_mtime = ct; //上次修改时间 int newblock; newblock = inode[newid].i_zone[0] = GetNextBlockNum(); //获取物理块号 Directory xx = Directory(); writeInBlock(newblock, (char*)&xx); }
//////////////////////////////////////////////////////////////////////////////// // A Path and a Subst may look similar, and so the rule is that if a Subst looks // like a path, it must also not exist in the file system in order to actually // be a Subst. bool Subst::valid (const std::string& input) const { std::string ignored; Nibbler n (input); if (n.skip ('/') && n.getUntil ('/', ignored) && n.skip ('/') && n.getUntil ('/', ignored) && n.skip ('/')) { n.skip ('g'); if (n.depleted ()) return ! Directory (input).exists (); } return false; }
TEST(findCompileArgsInJsonDatabase, FindsEntry) { StringRef Directory("directory"); StringRef FileName("file"); StringRef Command("command"); std::string JsonDatabase = "["; for (int I = 0; I < 10; ++I) { if (I > 0) JsonDatabase += ","; JsonDatabase += ("{\"directory\":\"" + Directory + Twine(I) + "\"," + "\"command\":\"" + Command + Twine(I) + "\"," "\"file\":\"" + FileName + Twine(I) + "\"}").str(); } JsonDatabase += "]"; std::string ErrorMessage; CompileCommand FoundCommand = findCompileArgsInJsonDatabase( "file4", JsonDatabase, ErrorMessage); EXPECT_EQ("directory4", FoundCommand.Directory) << ErrorMessage; ASSERT_EQ(1u, FoundCommand.CommandLine.size()) << ErrorMessage; EXPECT_EQ("command4", FoundCommand.CommandLine[0]) << ErrorMessage; }
HashExtensible::HashExtensible(std::string filename) { this->directory= Directory(); this->actualbits=directory.getActualBits(); this->filename=filename; ifstream file(filename.c_str()); if (file.is_open()) { file.close(); load(); } else { ofstream ofile(filename.c_str(),ios::trunc); ofile.close(); } }
/* * Constructs a Example which is a child of 'parent', with the * name 'name' and widget flags set to 'f' */ Accueil::Accueil(QWidget *parent, Qt::WFlags f) : QWidget(parent, f) { setupUi(this); // reads the .ui file to determine widgets and layout // Construct context menu, available to the user via Qtopia's soft menu bar. QMenu *menu = QSoftMenuBar::menuFor(this); menu->addAction(tr("Options"), this, SLOT(options())); menu->addAction(tr("Upgrade mplayer"), this, SLOT(upgrade())); QAction *actionClose = new QAction(QIcon("close"),tr("Close"),this); connect(actionClose,SIGNAL(triggered()), this, SLOT(close())); connect(RadioButton,SIGNAL(clicked()), this, SLOT(RadioButton_clicked())); connect(VideoButton,SIGNAL(clicked()), this, SLOT(VideoButton_clicked())); menu->addAction(actionClose); QSoftMenuBar::setHelpEnabled(this,false); //Test and create the .QmokoPlayer in the current home user if necessary QDir Directory(QDir::homePath () +"/.QMokoPlayer"); if (!Directory.exists()) Directory.mkdir(QDir::homePath () +"/.QMokoPlayer"); //verify if mplayer is already installed if (!QFile::exists("/usr/bin/mplayer")) { if(QMessageBox::question(this, tr("qmplayer"), tr("Program MPlayer must be downloaded. Please make sure you have internet connection and press yes to confirm download"), QMessageBox::Yes, QMessageBox::No) == QMessageBox::Yes) { if(installMplayer()) { QMessageBox::information(this, tr("qmplayer"), tr("MPlayer installed sucessfully")); } else QMessageBox::warning(this, tr("qmplayer"), tr("Failed to install MPlayer")); } } }
Path Directory::relativePathTo(Path path) const { if ( toString().empty() || path.toString().empty() ) return *this; Path path1 = absolutePath(); Path path2( Directory( path.directory() ).absolutePath() ); StringArray list1, list2; list1 = utils::split( path1.toString(), "/\\"); list2 = utils::split( path2.toString(), "/\\"); unsigned int i=0; for (; i<list1.size() && i<list2.size(); ++i) { utils::equaleMode emode = utils::equaleIgnoreCase; #ifdef CAESARIA_PLATFORM_UNIX emode = utils::equaleCase; #endif //CAESARIA_PLATFORM_UNIX if( !utils::isEquale( list1[ i ], list2[ i ], emode ) ) { break; } } path1=""; for( unsigned int k=i; k<list1.size(); ++k) { path1 = path1.toString() + "../"; } for( ; i < list2.size(); i++ ) { path1 = path1.toString() + list2[ i ] + "/"; } return path1.toString() + path.baseName().toString(); }
bool Mesh::chargerMesh(const string& filename) { //check if file exists ifstream fin(filename.c_str()); if (!fin.fail()) { fin.close(); } else { cout << "Couldn't open file." <<endl; return false; } Dir = Directory(filename); scene = importer.ReadFile(filename, aiProcessPreset_TargetRealtime_MaxQuality |aiProcess_GenUVCoords); QString s(Dir.c_str()); QDir d(s); Dir = d.absolutePath().toStdString(); if (!scene) { cout << "Import failed." << endl; return false; } InitFromScene(scene); cout << "Import scene succeeded.\n" << endl; return true; }
// Copies a File to another file // Throws fs::filesystem_error, ex::filesystem::AlreadyThere, // ex::filesystem::NotThere void File::copy(const fs::path& tos,Conflict c) { fs::path toss = tos; if (!exists()) Throw(ex::filesystem::NotThere,path().string()); // To consider paths like "hari/shiva/" Node to(tos); if( (to.exists() && to.what() == DIRECTORY) || (to.filename() == "." || to.filename() == "..")) toss /= filename(); File too(toss); if( too.exists() ){ if(c==LEAVE) Throw(ex::filesystem::AlreadyThere,too.path().string()); else if (c==NEW) path(newpath()); } close(); if( too.path().has_parent_path()) Directory(too.parentpath().string()).create(); fs::copy(path(),too.path()); }