On Wed, Oct 17, 2007 at 11:54:00PM +0200, Andre Poenitz wrote: > > Something like that?
Second try. Andre'
Index: TextClass.cpp =================================================================== --- TextClass.cpp (revision 21005) +++ TextClass.cpp (working copy) @@ -30,12 +30,8 @@ #include "support/filetools.h" #include "support/os.h" -#include <boost/filesystem/operations.hpp> - #include <sstream> -namespace fs = boost::filesystem; - namespace lyx { using support::FileName; @@ -1014,7 +1010,7 @@ FileName layout_file; if (!path.empty()) layout_file = FileName(addName(path, name_ + ".layout")); - if (layout_file.empty() || !fs::exists(layout_file.toFilesystemEncoding())) + if (layout_file.empty() || !layout_file.exists()) layout_file = libFileSearch("layouts", name_, "layout"); loaded_ = const_cast<TextClass*>(this)->read(layout_file) == 0; Index: insets/InsetInclude.cpp =================================================================== --- insets/InsetInclude.cpp (revision 21005) +++ insets/InsetInclude.cpp (working copy) @@ -48,7 +48,6 @@ #include "support/convert.h" #include <boost/bind.hpp> -#include <boost/filesystem/operations.hpp> namespace lyx { @@ -88,7 +87,6 @@ using std::vector; namespace Alert = frontend::Alert; -namespace fs = boost::filesystem; namespace { @@ -386,6 +384,7 @@ } // namespace anon + /// return true if the file is or got loaded. Buffer * loadIfNeeded(Buffer const & parent, InsetCommandParams const & params) { @@ -402,7 +401,7 @@ Buffer * child = theBufferList().getBuffer(included_file.absFilename()); if (!child) { // the readonly flag can/will be wrong, not anymore I think. - if (!fs::exists(included_file.toFilesystemEncoding())) + if (!included_file.exists()) return 0; child = theBufferList().newBuffer(included_file.absFilename()); Index: buffer_funcs.cpp =================================================================== --- buffer_funcs.cpp (revision 21005) +++ buffer_funcs.cpp (working copy) @@ -81,7 +81,7 @@ BOOST_ASSERT(b); // File information about normal file - if (!fs::exists(s.toFilesystemEncoding())) { + if (!s.exists()) { docstring const file = makeDisplayPath(s.absFilename(), 50); docstring text = bformat(_("The specified document\n%1$s" "\ncould not be read."), file); @@ -92,10 +92,7 @@ // Check if emergency save file exists and is newer. FileName const e(s.absFilename() + ".emergency"); - if (fs::exists(e.toFilesystemEncoding()) && - fs::exists(s.toFilesystemEncoding()) && - fs::last_write_time(e.toFilesystemEncoding()) > fs::last_write_time(s.toFilesystemEncoding())) - { + if (e.exists() && s.exists() && e.lastModified() > s.lastModified()) { docstring const file = makeDisplayPath(s.absFilename(), 20); docstring const text = bformat(_("An emergency save of the document " @@ -119,10 +116,7 @@ // Now check if autosave file is newer. FileName const a(onlyPath(s.absFilename()) + '#' + onlyFilename(s.absFilename()) + '#'); - if (fs::exists(a.toFilesystemEncoding()) && - fs::exists(s.toFilesystemEncoding()) && - fs::last_write_time(a.toFilesystemEncoding()) > fs::last_write_time(s.toFilesystemEncoding())) - { + if (a.exists() && s.exists() && a.lastModified() > s.lastModified()) { docstring const file = makeDisplayPath(s.absFilename(), 20); docstring const text = bformat(_("The backup of the document " Index: LyX.cpp =================================================================== --- LyX.cpp (revision 21005) +++ LyX.cpp (working copy) @@ -985,7 +985,7 @@ prependEnvPath("PATH", lyxrc.path_prefix); FileName const document_path(lyxrc.document_path); - if (fs::exists(document_path.toFilesystemEncoding()) && + if (document_path.exists() && fs::is_directory(document_path.toFilesystemEncoding())) package().document_dir() = document_path; Index: LaTeX.cpp =================================================================== --- LaTeX.cpp (revision 21005) +++ LaTeX.cpp (working copy) @@ -213,7 +213,7 @@ // remake the dependency file. // - bool had_depfile = fs::exists(depfile.toFilesystemEncoding()); + bool had_depfile = depfile.exists(); bool run_bibtex = false; FileName const aux_file(changeExtension(file.absFilename(), "aux")); @@ -230,7 +230,7 @@ // have aborted on error last time... in which cas we need // to re-run latex and collect the error messages // (even if they are the same). - if (!fs::exists(output_file.toFilesystemEncoding())) { + if (!output_file.exists()) { LYXERR(Debug::DEPEND) << "re-running LaTeX because output file doesn't exist." << endl; @@ -291,8 +291,7 @@ // memoir (at least) writes an empty *idx file in the first place. // A second latex run is needed. FileName const idxfile(changeExtension(file.absFilename(), ".idx")); - rerun = fs::exists(idxfile.toFilesystemEncoding()) && - fs::is_empty(idxfile.toFilesystemEncoding()); + rerun = idxfile.exists() && fs::is_empty(idxfile.toFilesystemEncoding()); // run makeindex if (head.haschanged(idxfile)) { @@ -480,7 +479,7 @@ FileName const file2(basename + '.' + convert<string>(i) + ".aux"); - if (!fs::exists(file2.toFilesystemEncoding())) + if (!file2.exists()) break; result.push_back(scanAuxFile(file2)); } @@ -770,30 +769,9 @@ namespace { -/** - * Wrapper around fs::exists that can handle invalid file names. - * In theory we could test with fs::native whether a filename is valid - * before calling fs::exists, but in practice it is unusable: On windows it - * does not allow spaces, and on unix it does not allow absolute file names. - * This function has the disadvantage that it catches also other errors than - * invalid names, but for dependency checking we can live with that. - */ -bool exists(FileName const & possible_name) { - try { - return fs::exists(possible_name.toFilesystemEncoding()); - } - catch (fs::filesystem_error const & fe) { - LYXERR(Debug::DEPEND) << "Got error `" << fe.what() - << "' while checking whether file `" << possible_name - << "' exists." << endl; - return false; - } -} - - bool insertIfExists(FileName const & absname, DepTable & head) { - if (exists(absname) && + if (absname.exists() && !fs::is_directory(absname.toFilesystemEncoding())) { head.insert(absname, true); return true; @@ -851,7 +829,7 @@ // check for spaces while (contains(foundfile, ' ')) { - if (exists(absname)) + if (absname.exists()) // everything o.k. break; else { @@ -859,7 +837,7 @@ // marks; those have to be removed string unquoted = subst(foundfile, "\"", ""); absname = makeAbsPath(unquoted); - if (exists(absname)) + if (absname.exists()) break; // strip off part after last space and try again string strippedfile; @@ -873,38 +851,28 @@ // (2) foundfile is in the tmpdir // insert it into head - if (exists(absname) && + if (absname.exists() && !fs::is_directory(absname.toFilesystemEncoding())) { // FIXME: This regex contained glo, but glo is used by the old // version of nomencl.sty. Do we need to put it back? - static regex unwanted("^.*\\.(aux|log|dvi|bbl|ind)$"); + static regex const unwanted("^.*\\.(aux|log|dvi|bbl|ind)$"); if (regex_match(onlyfile, unwanted)) { - LYXERR(Debug::DEPEND) - << "We don't want " - << onlyfile - << " in the dep file" - << endl; + LYXERR(Debug::DEPEND) << "We don't want " << onlyfile + << " in the dep file" << endl; } else if (suffixIs(onlyfile, ".tex")) { // This is a tex file generated by LyX // and latex is not likely to change this // during its runs. - LYXERR(Debug::DEPEND) - << "Tmpdir TeX file: " - << onlyfile - << endl; + LYXERR(Debug::DEPEND) << "Tmpdir TeX file: " << onlyfile << endl; head.insert(absname, true); } else { - LYXERR(Debug::DEPEND) - << "In tmpdir file:" - << onlyfile - << endl; + LYXERR(Debug::DEPEND) << "In tmpdir file:" << onlyfile << endl; head.insert(absname); } return true; } else { LYXERR(Debug::DEPEND) - << "Not a file or we are unable to find it." - << endl; + << "Not a file or we are unable to find it." << endl; return false; } } @@ -932,28 +900,28 @@ string const logfile = onlyFilename(changeExtension(file.absFilename(), ".log")); - static regex reg1("File: (.+).*"); - static regex reg2("No file (.+)(.).*"); - static regex reg3("\\\\openout[0-9]+.*=.*`(.+)(..).*"); + static regex const reg1("File: (.+).*"); + static regex const reg2("No file (.+)(.).*"); + static regex const reg3("\\\\openout[0-9]+.*=.*`(.+)(..).*"); // If an index should be created, MikTex does not write a line like // \openout# = 'sample.idx'. // but instead only a line like this into the log: // Writing index file sample.idx - static regex reg4("Writing index file (.+).*"); + static regex const reg4("Writing index file (.+).*"); // files also can be enclosed in <...> - static regex reg5("<([^>]+)(.).*"); - static regex regoldnomencl("Writing glossary file (.+).*"); - static regex regnomencl("Writing nomenclature file (.+).*"); + static regex const reg5("<([^>]+)(.).*"); + static regex const regoldnomencl("Writing glossary file (.+).*"); + static regex const regnomencl("Writing nomenclature file (.+).*"); // If a toc should be created, MikTex does not write a line like // \openout# = `sample.toc'. // but only a line like this into the log: // [EMAIL PROTECTED] // This line is also written by tetex. // This line is not present if no toc should be created. - static regex miktexTocReg("[EMAIL PROTECTED]"); - static regex reg6(".*\\([^)]+.*"); + static regex const miktexTocReg("[EMAIL PROTECTED]"); + static regex const reg6(".*\\([^)]+.*"); - FileName const fn(makeAbsPath(logfile)); + FileName const fn = makeAbsPath(logfile); ifstream ifs(fn.toFilesystemEncoding().c_str()); string lastline; while (ifs) { @@ -980,8 +948,8 @@ // Here we exclude some cases where we are sure // that there is no continued filename if (!lastline.empty()) { - static regex package_info("Package \\w+ Info: .*"); - static regex package_warning("Package \\w+ Warning: .*"); + static regex const package_info("Package \\w+ Info: .*"); + static regex const package_warning("Package \\w+ Warning: .*"); if (prefixIs(token, "File:") || prefixIs(token, "(Font)") || prefixIs(token, "Package:") || prefixIs(token, "Language:") Index: TextClassList.cpp =================================================================== --- TextClassList.cpp (revision 21005) +++ TextClassList.cpp (working copy) @@ -20,12 +20,11 @@ #include <boost/bind.hpp> #include <boost/regex.hpp> -#include <boost/filesystem/operations.hpp> + #include <fstream> namespace lyx { -namespace fs = boost::filesystem; using support::FileName; using support::addName; @@ -194,7 +193,7 @@ // only check for textclass.layout file, .cls can be anywhere in $TEXINPUTS // NOTE: latex class name is defined in textclass.layout, which can be different from textclass FileName const layout_file(addName(path, textclass + ".layout")); - if (fs::exists(layout_file.toFilesystemEncoding())) { + if (layout_file.exists()) { LYXERR(Debug::TCLASS) << "Adding class " << textclass << " from directory " << path << endl; // Read .layout file and get description, real latex classname etc // Index: Session.cpp =================================================================== --- Session.cpp (revision 21005) +++ Session.cpp (working copy) @@ -78,7 +78,7 @@ // read lastfiles FileName const file(tmp); - if (fs::exists(file.toFilesystemEncoding()) && + if (file.exists() && !fs::is_directory(file.toFilesystemEncoding()) && lastfiles.size() < num_lastfiles) lastfiles.push_back(file); @@ -133,7 +133,7 @@ continue; FileName const file(tmp); - if (fs::exists(file.toFilesystemEncoding()) && + if (file.exists() && !fs::is_directory(file.toFilesystemEncoding())) lastopened.push_back(file); else @@ -188,7 +188,7 @@ if (!absolutePath(fname)) continue; FileName const file(fname); - if (fs::exists(file.toFilesystemEncoding()) && + if (file.exists() && !fs::is_directory(file.toFilesystemEncoding()) && lastfilepos.size() < num_lastfilepos) lastfilepos[file] = boost::tie(pit, pos); @@ -269,7 +269,7 @@ continue; FileName const file(fname); // only load valid bookmarks - if (fs::exists(file.toFilesystemEncoding()) && + if (file.exists() && !fs::is_directory(file.toFilesystemEncoding()) && idx <= max_bookmarks) bookmarks[idx] = Bookmark(file, pit, pos, 0, 0); Index: LyXFunc.cpp =================================================================== --- LyXFunc.cpp (revision 21005) +++ LyXFunc.cpp (working copy) @@ -1153,7 +1153,7 @@ FileName const filename(makeAbsPath(target_name, lyx_view_->buffer()->filePath())); FileName const dvifile(makeAbsPath(dviname, path)); - if (fs::exists(filename.toFilesystemEncoding())) { + if (filename.exists()) { docstring text = bformat( _("The file %1$s already exists.\n\n" "Do you want to overwrite that file?"), @@ -2120,7 +2120,7 @@ filename = fullname.absFilename(); // if the file doesn't exist, let the user create one - if (!fs::exists(fullname.toFilesystemEncoding())) { + if (!fullname.exists()) { // the user specifically chose this name. Believe him. Buffer * const b = newFile(filename, string(), true); if (b) @@ -2212,7 +2212,7 @@ // if the file exists already, and we didn't do // -i lyx thefile.lyx, warn - if (fs::exists(lyxfile.toFilesystemEncoding()) && fullname != lyxfile) { + if (lyxfile.exists() && fullname != lyxfile) { docstring const file = makeDisplayPath(lyxfile.absFilename(), 30); docstring text = bformat(_("The document %1$s already exists.\n\n" Index: support/FileMonitor.cpp =================================================================== --- support/FileMonitor.cpp (revision 21005) +++ support/FileMonitor.cpp (working copy) @@ -16,14 +16,11 @@ #include "support/Timeout.h" #include <boost/bind.hpp> -#include <boost/filesystem/operations.hpp> #include <boost/signals/trackable.hpp> using std::string; -namespace fs = boost::filesystem; - namespace lyx { namespace support { @@ -90,10 +87,10 @@ if (monitoring()) return; - if (!fs::exists(pimpl_->filename_.toFilesystemEncoding())) + if (!pimpl_->filename_.exists()) return; - pimpl_->timestamp_ = fs::last_write_time(pimpl_->filename_.toFilesystemEncoding()); + pimpl_->timestamp_ = pimpl_->filename_.lastModified(); pimpl_->checksum_ = sum(pimpl_->filename_); if (pimpl_->timestamp_ && pimpl_->checksum_) { @@ -155,13 +152,13 @@ { bool changed = false; - if (!fs::exists(filename_.toFilesystemEncoding())) { + if (!filename_.exists()) { changed = timestamp_ || checksum_; timestamp_ = 0; checksum_ = 0; } else { - time_t const new_timestamp = fs::last_write_time(filename_.toFilesystemEncoding()); + time_t const new_timestamp = filename_.lastModified(); if (new_timestamp != timestamp_) { timestamp_ = new_timestamp; Index: support/Package.cpp =================================================================== --- support/Package.cpp (revision 21005) +++ support/Package.cpp (working copy) @@ -356,14 +356,12 @@ FileName path(normalizePath(addPath(system_support_dir.absFilename(), relative_locale_dir()))); - if (fs::exists(path.toFilesystemEncoding()) && - fs::is_directory(path.toFilesystemEncoding())) + if (path.exists() && fs::is_directory(path.toFilesystemEncoding())) return path; // 3. Fall back to the hard-coded LOCALEDIR. path = hardcoded_localedir(); - if (fs::exists(path.toFilesystemEncoding()) && - fs::is_directory(path.toFilesystemEncoding())) + if (path.exists() && fs::is_directory(path.toFilesystemEncoding())) return path; return FileName(); @@ -415,7 +413,7 @@ // Two possibilities present themselves. // 1. The binary is relative to the CWD. FileName const abs_exe_path = makeAbsPath(exe_path); - if (fs::exists(abs_exe_path.toFilesystemEncoding())) + if (abs_exe_path.exists()) return abs_exe_path; // 2. exe must be the name of the binary only and it @@ -432,7 +430,7 @@ string const exe_dir = makeAbsPath(*it).absFilename(); FileName const exe_path(addName(exe_dir, exe_name)); - if (fs::exists(exe_path.toFilesystemEncoding())) + if (exe_path.exists()) return exe_path; } @@ -697,8 +695,8 @@ bool check_env_var_dir(FileName const & dir, string const & env_var) { - string const encoded(dir.toFilesystemEncoding()); - bool const success = (fs::exists(encoded) && fs::is_directory(encoded)); + string const encoded = dir.toFilesystemEncoding(); + bool const success = (dir.exists() && fs::is_directory(encoded)); if (!success) { // Put this string on a single line so that the gettext Index: Exporter.cpp =================================================================== --- Exporter.cpp (revision 21005) +++ Exporter.cpp (working copy) @@ -78,7 +78,7 @@ /// ask the user what to do if a file already exists int checkOverwrite(FileName const & filename) { - if (fs::exists(filename.toFilesystemEncoding())) { + if (filename.exists()) { docstring text = bformat(_("The file %1$s already exists.\n\n" "Do you want to overwrite that file?"), makeDisplayPath(filename.absFilename())); @@ -243,7 +243,7 @@ } if (status == CANCEL) { buffer->message(_("Document export cancelled.")); - } else if (fs::exists(tmp_result_file.toFilesystemEncoding())) { + } else if (tmp_result_file.exists()) { // Finally copy the main file status = copyFile(format, tmp_result_file, FileName(result_file), result_file, Index: Format.cpp =================================================================== --- Format.cpp (revision 21005) +++ Format.cpp (working copy) @@ -26,8 +26,6 @@ #include "support/os.h" #include "support/Systemcall.h" -#include <boost/filesystem/operations.hpp> - using std::find_if; using std::string; using std::distance; @@ -49,7 +47,6 @@ using support::token; namespace Alert = frontend::Alert; -namespace fs = boost::filesystem; namespace os = support::os; namespace { @@ -266,7 +263,7 @@ bool Formats::view(Buffer const & buffer, FileName const & filename, string const & format_name) const { - if (filename.empty() || !fs::exists(filename.toFilesystemEncoding())) { + if (filename.empty() || !filename.exists()) { Alert::error(_("Cannot view file"), bformat(_("File does not exist: %1$s"), from_utf8(filename.absFilename()))); @@ -336,7 +333,7 @@ bool Formats::edit(Buffer const & buffer, FileName const & filename, string const & format_name) const { - if (filename.empty() || !fs::exists(filename.toFilesystemEncoding())) { + if (filename.empty() || !filename.exists()) { Alert::error(_("Cannot edit file"), bformat(_("File does not exist: %1$s"), from_utf8(filename.absFilename()))); Index: ConverterCache.cpp =================================================================== --- ConverterCache.cpp (revision 21005) +++ ConverterCache.cpp (working copy) @@ -135,7 +135,7 @@ CacheItem item(orig_from_name, to_format, timestamp, checksum); // Don't cache files that do not exist anymore - if (!fs::exists(orig_from_name.toFilesystemEncoding())) { + if (!orig_from_name.exists()) { LYXERR(Debug::FILES) << "Not caching file `" << orig_from << "' (does not exist anymore)." << std::endl; @@ -146,7 +146,7 @@ // Don't add items that are not in the cache anymore // This can happen if two instances of LyX are running // at the same time and update the index file independantly. - if (!fs::exists(item.cache_name.toFilesystemEncoding())) { + if (!item.cache_name.exists()) { LYXERR(Debug::FILES) << "Not caching file `" << orig_from << "' (cached copy does not exist anymore)." @@ -155,8 +155,8 @@ } // Delete the cached file if it is too old - if (difftime(now, fs::last_write_time(item.cache_name.toFilesystemEncoding())) > - lyxrc.converter_cache_maxage) { + if (difftime(now, item.cache_name.lastModified()) + > lyxrc.converter_cache_maxage) { LYXERR(Debug::FILES) << "Not caching file `" << orig_from << "' (too old)." << std::endl; support::unlink(item.cache_name); @@ -228,7 +228,7 @@ // We do this here and not in the constructor because package() gets // initialized after all static variables. cache_dir = FileName(addName(support::package().user_support().absFilename(), "cache")); - if (!fs::exists(cache_dir.toFilesystemEncoding())) + if (!cache_dir.exists()) if (support::mkdir(cache_dir, 0700) != 0) { lyxerr << "Could not create cache directory `" << cache_dir << "'." << std::endl; @@ -273,7 +273,7 @@ // Is the file in the cache already? CacheItem * item = pimpl_->find(orig_from, to_format); - time_t const timestamp = fs::last_write_time(orig_from.toFilesystemEncoding()); + time_t const timestamp = orig_from.lastModified(); Mover const & mover = getMover(to_format); if (item) { LYXERR(Debug::FILES) << "ConverterCache::add(" << orig_from << "):\n" Index: tex2lyx/text.cpp =================================================================== --- tex2lyx/text.cpp (revision 21005) +++ tex2lyx/text.cpp (working copy) @@ -360,7 +360,7 @@ // expects utf8) for (char const * const * what = extensions; *what; ++what) { string const trial = addExtension(name, *what); - if (fs::exists(makeAbsPath(trial, path).toFilesystemEncoding())) + if (makeAbsPath(trial, path).exists()) return trial; } return string(); @@ -1539,7 +1539,7 @@ // therefore path is only used for testing // FIXME UNICODE encoding of name and path may be // wrong (makeAbsPath expects utf8) - if (!fs::exists(makeAbsPath(name, path).toFilesystemEncoding())) { + if (!makeAbsPath(name, path).exists()) { // The file extension is probably missing. // Now try to find it out. string const dvips_name = @@ -1571,7 +1571,7 @@ // FIXME UNICODE encoding of name and path may be // wrong (makeAbsPath expects utf8) - if (fs::exists(makeAbsPath(name, path).toFilesystemEncoding())) + if (makeAbsPath(name, path).exists()) fix_relative_filename(name); else cerr << "Warning: Could not find graphics file '" @@ -2203,7 +2203,7 @@ // FIXME UNICODE encoding of filename and path may be // wrong (makeAbsPath expects utf8) if ((t.cs() == "include" || t.cs() == "input") && - !fs::exists(makeAbsPath(filename, path).toFilesystemEncoding())) { + !makeAbsPath(filename, path).exists()) { // The file extension is probably missing. // Now try to find it out. string const tex_name = @@ -2214,7 +2214,7 @@ } // FIXME UNICODE encoding of filename and path may be // wrong (makeAbsPath expects utf8) - if (fs::exists(makeAbsPath(filename, path).toFilesystemEncoding())) { + if (makeAbsPath(filename, path).exists()) { string const abstexname = makeAbsPath(filename, path).absFilename(); string const abslyxname = Index: Buffer.cpp =================================================================== --- Buffer.cpp (revision 21022) +++ Buffer.cpp (working copy) @@ -432,9 +432,8 @@ // If no Latex log or Build log is newer, show Build log - if (fs::exists(bname.toFilesystemEncoding()) && - (!fs::exists(fname.toFilesystemEncoding()) || - fs::last_write_time(fname.toFilesystemEncoding()) < fs::last_write_time(bname.toFilesystemEncoding()))) { + if (bname.exists() && + (!fname.exists() || fname.lastModified() < bname.lastModified())) { LYXERR(Debug::FILES) << "Log name calculated as: " << bname << endl; return make_pair(Buffer::buildlog, bname.absFilename()); } @@ -704,7 +703,7 @@ // FileName lyxfile(addName(temppath(), "content.lyx")); // if both manifest.txt and file.lyx exist, this is am embedded file - if (fs::exists(lyxfile.toFilesystemEncoding())) { + if (lyxfile.exists()) { params().embedded = true; fname = lyxfile; } @@ -1661,10 +1660,10 @@ bool Buffer::isExternallyModified(CheckMethod method) const { - BOOST_ASSERT(fs::exists(pimpl_->filename.toFilesystemEncoding())); + BOOST_ASSERT(pimpl_->filename.exists()); // if method == timestamp, check timestamp before checksum return (method == checksum_method - || pimpl_->timestamp_ != fs::last_write_time(pimpl_->filename.toFilesystemEncoding())) + || pimpl_->timestamp_ != pimpl_->filename.lastModified()) && pimpl_->checksum_ != sum(pimpl_->filename); } @@ -2152,7 +2151,7 @@ } else fname = makeAbsPath(newname, onlyPath(oldname)).absFilename(); - if (fs::exists(FileName(fname).toFilesystemEncoding())) { + if (FileName(fname).exists()) { docstring const file = makeDisplayPath(fname, 30); docstring text = bformat(_("The document %1$s already " "exists.\n\nDo you want to "