]> git.lyx.org Git - features.git/commitdiff
* makeLatexName(): port to FileName.
authorAbdelrazak Younes <younes@lyx.org>
Wed, 28 Nov 2007 18:07:09 +0000 (18:07 +0000)
committerAbdelrazak Younes <younes@lyx.org>
Wed, 28 Nov 2007 18:07:09 +0000 (18:07 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@21848 a592a061-630c-0410-9148-cb99ea01b6c8

src/Buffer.cpp
src/support/filetools.cpp
src/support/filetools.h

index ef57cec7845f110a3fc918538c10f8fc0f6ca8b5..c2e3444148c39eb91b235976aa55fceb7529da41 100644 (file)
@@ -392,8 +392,9 @@ Undo & Buffer::undo()
 
 string Buffer::latexName(bool const no_path) const
 {
-       string const name = changeExtension(makeLatexName(absFileName()), ".tex");
-       return no_path ? onlyFilename(name) : name;
+       FileName latex_name = makeLatexName(pimpl_->filename);
+       return no_path ? latex_name.onlyFileName()
+               : latex_name.absFilename();
 }
 
 
index 6321344aa411e5586c2d50c9b857b064ac6d8ad8..3855794609a1280b5459b34fbd282b15f857355e 100644 (file)
@@ -109,12 +109,14 @@ string const latex_path(string const & original_path,
 
 
 // Substitutes spaces with underscores in filename (and path)
-string const makeLatexName(string const & file)
+FileName const makeLatexName(FileName const & file)
 {
-       string name = onlyFilename(file);
-       string const path = onlyPath(file);
+       string name = file.onlyFileName();
+       string const path = file.onlyPath().absFilename() + "/";
 
        // ok so we scan through the string twice, but who cares.
+       // FIXME: in Unicode time this will break for sure! There is
+       // a non-latin world out there...
        string const keep = "abcdefghijklmnopqrstuvwxyz"
                "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
                "@!'()*+,-./0123456789:;<=>?[]`|";
@@ -123,7 +125,9 @@ string const makeLatexName(string const & file)
        while ((pos = name.find_first_not_of(keep, pos)) != string::npos)
                name[pos++] = '_';
 
-       return addName(path, name);
+       FileName latex_name(path + name);
+       latex_name.changeExtension(".tex");
+       return latex_name;
 }
 
 
index 512d78db80e2d33147e0a82c7bacd7d2f40e7287..5bd8167fb64f613e7b33b220ad1e856102441872 100644 (file)
@@ -152,7 +152,7 @@ std::string const latex_path(std::string const & path,
                latex_path_dots dots = LEAVE_DOTS);
 
 /// Substitutes active latex characters with underscores in filename
-std::string const makeLatexName(std::string const & file);
+FileName const makeLatexName(FileName const & file);
 
 /** Put the name in quotes suitable for the current shell or python,
     depending on \p style. */