Transfer getcwd() implementation to FileName.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@22164 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Abdelrazak Younes 2007-12-16 10:18:00 +00:00
parent 86506a80eb
commit c66e214724
10 changed files with 14 additions and 37 deletions

View File

@ -344,7 +344,6 @@ src_support_files = Split('''
environment.cpp
filetools.cpp
gzstream.cpp
getcwd.cpp
gettext.cpp
kill.cpp
lstrings.cpp

View File

@ -159,7 +159,7 @@ int LaTeX::run(TeXErrors & terr)
bool rerun = false; // rerun requested
// The class LaTeX does not know the temp path.
theBufferList().updateIncludedTeXfiles(getcwd().absFilename(),
theBufferList().updateIncludedTeXfiles(FileName::getcwd().absFilename(),
runparams);
// Never write the depfile if an error was encountered.

View File

@ -52,7 +52,7 @@ public:
*
* Up to two optional extra buttons are allowed for specifying
* additional directories in the navigation (an empty
* directory is interpreted as getcwd())
* directory is interpreted as FileName::getcwd())
*/
FileDialog(docstring const & title, kb_action a = LFUN_SELECT_FILE_SYNC);

View File

@ -399,6 +399,12 @@ FileName FileName::tempName(string const & mask)
}
FileName FileName::getcwd()
{
return FileName(".");
}
time_t FileName::lastModified() const
{
return d->fi.lastModified().toTime_t();

View File

@ -154,6 +154,9 @@ public:
/// temporary directory as given by 'package().temp_dir()'.
static FileName tempName(std::string const & mask = empty_string());
/// get the current working directory
static FileName getcwd();
/// filename without path
std::string onlyFileName() const;
/// path without file name

View File

@ -64,7 +64,6 @@ liblyxsupport_la_SOURCES = \
ForkedCalls.h \
gettext.cpp \
gettext.h \
getcwd.cpp \
gzstream.cpp \
gzstream.h \
kill.cpp \

View File

@ -24,7 +24,7 @@ PathChanger::PathChanger(FileName const & path)
: popped_(false)
{
if (!path.empty()) {
pushedDir_ = getcwd();
pushedDir_ = FileName::getcwd();
if (pushedDir_.empty() || !path.chdir()) {
/* FIXME: throw */

View File

@ -410,7 +410,7 @@ FileName const makeAbsPath(string const & relPath, string const & basePath)
if (os::is_absolute_path(basePath))
tempBase = basePath;
else
tempBase = addPath(getcwd().absFilename(), basePath);
tempBase = addPath(FileName::getcwd().absFilename(), basePath);
// Handle /./ at the end of the path
while (suffixIs(tempBase, "/./"))
@ -508,7 +508,7 @@ string const expandPath(string const & path)
rTemp = split(rTemp, temp, '/');
if (temp == ".")
return getcwd().absFilename() + '/' + rTemp;
return FileName::getcwd().absFilename() + '/' + rTemp;
if (temp == "~")
return package().home_dir().absFilename() + '/' + rTemp;

View File

@ -1,25 +0,0 @@
/**
* \file getcwd.cpp
* This file is part of LyX, the document processor.
* Licence details can be found in the file COPYING.
*
* \author Lars Gullik Bjønnes
*
* Full author contact details are available in file CREDITS.
*/
#include <config.h>
#include "support/lyxlib.h"
namespace lyx {
namespace support {
// Returns current working directory
FileName const getcwd()
{
return FileName(".");
}
} // namespace support
} // namespace lyx

View File

@ -15,17 +15,12 @@
#ifndef LYX_LIB_H
#define LYX_LIB_H
#include "support/FileName.h"
#include <string>
namespace lyx {
namespace support {
/// get the current working directory
FileName const getcwd();
/// FIXME: some point to this hmm ?
int kill(int pid, int sig);
/// FIXME: same here