Add calcInzipName.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@24040 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Richard Heck 2008-03-29 15:37:22 +00:00
parent 54a7f725db
commit c811c3a2ad
2 changed files with 17 additions and 6 deletions

View File

@ -368,11 +368,13 @@ const std::string absDirName = "LyX.Embed.Dir.Abs";
const std::string driveName = "LyX.Embed.Drive";
const std::string spaceName = "LyX.Embed.Space";
std::string EmbeddedFile::calcInzipName(std::string const & buffer_path)
// static
std::string EmbeddedFile::calcInzipName(
std::string const & file, std::string const & buffer_path)
{
string inzipName = to_utf8(makeRelPath(from_utf8(absFilename()),
string inzipName = to_utf8(makeRelPath(from_utf8(file),
from_utf8(buffer_path)));
if (FileName(inzipName).isAbsolute())
inzipName = absDirName + '/' + inzipName;
@ -390,6 +392,12 @@ std::string EmbeddedFile::calcInzipName(std::string const & buffer_path)
}
std::string EmbeddedFile::calcInzipName(std::string const & buffer_path)
{
return calcInzipName(absFilename(), buffer_path);
}
void EmbeddedFile::syncInzipFile(std::string const & buffer_path)
{
BOOST_ASSERT(enabled());

View File

@ -171,10 +171,13 @@ public:
/// Calculate checksum of availableFile
unsigned long checksum() const;
// calculate inzip_name_ from filename
/// calculate inzip_name_ from filename
static std::string
calcInzipName(std::string const & file, std::string const & path);
/// calculate inzip_name_ from filename
std::string calcInzipName(std::string const & buffer_path);
// move an embedded disk file with an existing inzip_name_ to
// a calculated inzip_name_, if they differ.
/// move an embedded disk file with an existing inzip_name_ to
/// a calculated inzip_name_, if they differ.
void syncInzipFile(std::string const & buffer_path);
private: