+2004-12-19 Angus Leeming <leeming@lyx.org>
+
+ * buffer.C (save): s/slashify_path/internal_path/.
+
2004-12-20 Jürgen Spitzmüller <j.spitzmueller@gmx.de>
* lyxfind.C (findChange): do not search for end of pars, because
s = fileName() + '~';
if (!lyxrc.backupdir_path.empty())
s = AddName(lyxrc.backupdir_path,
- subst(os::slashify_path(s),'/','!'));
+ subst(os::internal_path(s),'/','!'));
// Rename is the wrong way of making a backup,
// this is the correct way.
+2004-12-19 Angus Leeming <leeming@lyx.org>
+
+ * lyx_gui.C (start): s/slashify_path/internal_path/
+
2004-12-19 Georg Baum <Georg.Baum@post.rwth-aachen.de>
* ghelpers.C (getDefaultUnit): add return statement to shut up the
lyxserver = new LyXServer(&view.getLyXFunc(), lyxrc.lyxpipes);
lyxsocket = new LyXServerSocket(&view.getLyXFunc(),
- os::slashify_path(os::getTmpDir() + "/lyxsocket"));
+ os::internal_path(os::getTmpDir() + "/lyxsocket"));
for_each(files.begin(), files.end(),
bind(&BufferView::loadLyXFile, view.view(), _1, true));
+2004-12-19 Angus Leeming <leeming@lyx.org>
+
+ * lyx_gui.C (start): s/slashify_path/internal_path/
+
2004-12-16 Angus Leeming <leeming@lyx.org>
* qt_helpers.C (fromqstr): Don't use std::string(0) to construct
lyxserver = new LyXServer(&view.getLyXFunc(), lyxrc.lyxpipes);
lyxsocket = new LyXServerSocket(&view.getLyXFunc(),
- os::slashify_path(os::getTmpDir() + "/lyxsocket"));
+ os::internal_path(os::getTmpDir() + "/lyxsocket"));
for_each(files.begin(), files.end(),
bind(&BufferView::loadLyXFile, view.view(), _1, true));
+2004-12-19 Angus Leeming <leeming@lyx.org>
+
+ * lyx_gui.C (start): s/slashify_path/internal_path/
+
2004-12-16 Jürgen Spitzmüller <j.spitzmueller@gmx.de>
* FormMathsBitmap.C: Do not split strings with blank into two
lyxserver = new LyXServer(&view->getLyXFunc(), lyxrc.lyxpipes);
lyxsocket = new LyXServerSocket(&view->getLyXFunc(),
- os::slashify_path(os::getTmpDir() + "/lyxsocket"));
+ os::internal_path(os::getTmpDir() + "/lyxsocket"));
for_each(files.begin(), files.end(),
bind(&BufferView::loadLyXFile, view->view(), _1, true));
+2004-12-19 Angus Leeming <leeming@lyx.org>
+
+ * path_defines.C.in (setLyxPaths): on a Windows build,
+ remove the ".exe" extension from the name of the LyX binary when
+ trying to ascertain the name of the LyX system directory.
+ (Usually, <path to binary>/../share/<name of binary>/).
+
+ * os.h, os_os2.C, os_unix.C, os_win32.C (slashify_path): remove.
+
+ * os_win32.C (init): ensure that the name of the lyx executable is
+ stored internally with a unix-style path.
+
+ * os_win32.C (internal_path, external_path): differentiate between
+ cygwin and windows builds.
+
+ * filetools.C (FileOpenSearch, GetEnvPath, createDirectory,
+ MakeAbsPath, AddName, MakeRelPath, ChangeExtension):
+ * filename.C (mangledFilename):
+ s/slashify_path/internal_path/.
+
2004-12-16 Angus Leeming <leeming@lyx.org>
* filename.C (mangledFilename): Given a Windows-style path, don't
return (*it).second;
// Now the real work
- string mname = os::slashify_path(name_);
+ string mname = os::internal_path(name_);
// Remove the extension.
mname = ChangeExtension(name_, string());
// Replace '/' in the file name with '_'
string tmppath = split(path, path_element, ';');
while (notfound && !path_element.empty()) {
- path_element = os::slashify_path(path_element);
+ path_element = os::internal_path(path_element);
if (!suffixIs(path_element, '/'))
path_element+= '/';
path_element = subst(path_element, "$$LyX", system_lyxdir());
#ifndef __EMX__
string const pathlist = subst(GetEnv(name), ':', ';');
#else
- string const pathlist = os::slashify_path(GetEnv(name));
+ string const pathlist = os::internal_path(GetEnv(name));
#endif
return rtrim(pathlist, ";");
}
bool createDirectory(string const & path, int permission)
{
- string temp(rtrim(os::slashify_path(path), "/"));
+ string temp(rtrim(os::internal_path(path), "/"));
BOOST_ASSERT(!temp.empty());
return RelPath;
// Copies given paths
- string TempRel(os::slashify_path(RelPath));
+ string TempRel(os::internal_path(RelPath));
// Since TempRel is NOT absolute, we can safely replace "//" with "/"
TempRel = subst(TempRel, "//", "/");
}
// returns absolute path
- return os::slashify_path(TempBase);
+ return os::internal_path(TempBase);
}
string buf;
if (path != "." && path != "./" && !path.empty()) {
- buf = os::slashify_path(path);
+ buf = os::internal_path(path);
if (!suffixIs(path, '/'))
buf += '/';
}
string const AddPath(string const & path, string const & path_2)
{
string buf;
- string const path2 = os::slashify_path(path_2);
+ string const path2 = os::internal_path(path_2);
if (!path.empty() && path != "." && path != "./") {
- buf = os::slashify_path(path);
+ buf = os::internal_path(path);
if (path[path.length() - 1] != '/')
buf += '/';
}
else
ext = extension;
- return os::slashify_path(oldname.substr(0, last_dot) + ext);
+ return os::internal_path(oldname.substr(0, last_dot) + ext);
}
shell_type shell();
// DBCS aware!
std::string::size_type common_path(std::string const & p1, std::string const & p2);
-// no-op on UNIX, '\\'->'/' on OS/2 and Win32, ':'->'/' on MacOS, etc.
-std::string slashify_path(std::string const & p);
// Converts a unix style path to host OS style.
std::string external_path(std::string const & p);
// Converts a host OS style path to unix style.
if (rc != NO_ERROR)
exit(rc);
string p = tmp.get();
- p = slashify_path(p);
+ p = internal_path(p);
binname_ = OnlyFilename(p);
binname_.erase(binname_.length()-4, string::npos);
binpath_ = OnlyPath(p);
COUNTRYCODE cntry;
cntry.country = 0;
cntry.codepage = cp_;
- string temp1 = slashify_path(p1);
- string temp2 = slashify_path(p2);
+ string temp1 = internal_path(p1);
+ string temp2 = internal_path(p2);
char * tmp1 = const_cast<char *> (temp1.c_str());
char * tmp2 = const_cast<char *> (temp2.c_str());
/* rc = */ DosMapCase(p1.length(), &cntry, tmp1);
}
-string slashify_path(string const & p)
+string internal_path(string const & p)
{
static bool initialized = false;
static bool leadbyte[256] = {false};
}
-string internal_path(string const & p)
-{
- return p;
-}
-
-
bool is_absolute_path(string const & p)
{
return (p.length() > 1
}
-string slashify_path(string const & p)
-{
- return p;
-}
-
-
string external_path(string const & p)
{
return p;
return;
initialized = true;
- string tmp = argv[0];
+ string tmp = internal_path(argv[0]);
binname_ = OnlyFilename(tmp);
tmp = ExpandPath(tmp); // This expands ./ and ~/
string binsearchpath = GetEnvPath("PATH");
// This will make "src/lyx" work always :-)
binsearchpath += ";.";
- tmp = argv[0];
+ tmp = internal_path(argv[0]);
tmp = FileOpenSearch(binsearchpath, tmp);
}
}
-string slashify_path(string const & p)
-{
- return subst(p, '\\', '/');
-}
-
-
string external_path(string const & p)
{
- string dos_path = p;
+ string dos_path;
+#ifdef __CYGWIN__
+ // Translate from cygwin path syntax to dos path syntax
if (is_absolute_path(p)) {
- char dp[255];
+ char dp[MAX_PATH];
cygwin_conv_to_full_win32_path(p.c_str(), dp);
- dos_path = subst(dp,'\\','/');
+ dos_path = !dp ? "" : dp;
}
+
+ else return p;
+#else // regular Win32
+ dos_path = p;
+#endif
+
+ //No backslashes in LaTeX files
+ dos_path = subst(dos_path,'\\','/');
+
lyxerr[Debug::LATEX]
<< "<Win32 path correction> ["
<< p << "]->>["
// the Win32/DOS pathnames into Cygwin pathnames.
string internal_path(string const & p)
{
- char pp[256];
+#ifdef __CYGWIN__
+ char pp[MAX_PATH];
cygwin_conv_to_posix_path(p.c_str(), pp);
string const posix_path = MakeLatexName(pp);
+#else
+ string const posix_path = subst(p,"\\","/");
+#endif
lyxerr[Debug::DEPEND]
<< "<Win32 path correction> ["
<< p << "]->>["
bool followlink;
do {
// Path of binary/../share/name of binary/
- searchpath += NormalizePath(AddPath(binpath, "../share/") +
- OnlyFilename(binname)) + ';';
+ string const exe_name = OnlyFilename(binname);
+#ifdef _WIN32
+ string const lyx_system_dir_name =
+ suffixIs(exe_name, ".exe") ?
+ ChangeExtension(exe_name, "") :
+ exe_name;
+#else
+ string const lyx_system_dir_name = exe_name;
+#endif
+ string const shared_dir_name =
+ NormalizePath(AddPath(binpath, "../share/"));
+ searchpath += shared_dir_name + lyx_system_dir_name + ';';
// Follow Symlinks
FileInfo file(fullbinpath, true);