texlive[61533] Build/source/texk/dvisvgm/dvisvgm-src/src: Slightly

commits+siepo at tug.org commits+siepo at tug.org
Sat Jan 8 22:20:30 CET 2022


Revision: 61533
          http://tug.org/svn/texlive?view=revision&revision=61533
Author:   siepo
Date:     2022-01-08 22:20:29 +0100 (Sat, 08 Jan 2022)
Log Message:
-----------
Slightly modified patch for dvisvgm from Naveen for gcc 11

Modified Paths:
--------------
    trunk/Build/source/texk/dvisvgm/dvisvgm-src/src/FileSystem.cpp
    trunk/Build/source/texk/dvisvgm/dvisvgm-src/src/FileSystem.hpp

Modified: trunk/Build/source/texk/dvisvgm/dvisvgm-src/src/FileSystem.cpp
===================================================================
--- trunk/Build/source/texk/dvisvgm/dvisvgm-src/src/FileSystem.cpp	2022-01-08 18:39:01 UTC (rev 61532)
+++ trunk/Build/source/texk/dvisvgm/dvisvgm-src/src/FileSystem.cpp	2022-01-08 21:20:29 UTC (rev 61533)
@@ -34,8 +34,6 @@
 #endif
 
 
-using namespace std;
-
 #ifdef _WIN32
 	#include <direct.h>
 	#include "windows.hpp"
@@ -52,6 +50,8 @@
 #endif
 
 
+using namespace std;
+
 string FileSystem::TMPDIR;
 FileSystem::TemporaryDirectory FileSystem::_tmpdir;
 
@@ -135,10 +135,12 @@
 }
 
 
+/** Returns the absolute path of the current working directory. */
 string FileSystem::getcwd () {
 	char buf[1024];
 #ifdef _WIN32
-	return ensureForwardSlashes(_getcwd(buf, 1024));
+	GetCurrentDirectoryA(1024, buf);
+	return ensureForwardSlashes(buf);
 #else
 	return ::getcwd(buf, 1024);
 #endif
@@ -145,6 +147,26 @@
 }
 
 
+#ifdef _WIN32
+/** Returns the absolute path of the current directory of a given drive.
+ *  Windows keeps a current directory for every drive, i.e. when accessing a drive
+ *  without specifying a path (e.g. with "cd z:"), the current directory of that
+ *  drive is used.
+ *  @param[in] drive letter of drive to get the current directory from
+ *  @return absolute path of the directory */
+string FileSystem::getcwd (char drive) {
+	string cwd = getcwd();
+	if (cwd.length() > 1 && cwd[1] == ':' && tolower(cwd[0]) != tolower(drive)) {
+		chdir(string(1, drive)+":");
+		string cwd2 = cwd;
+		cwd = getcwd();
+		chdir(string(1, cwd2[0])+":");
+	}
+	return cwd;
+}
+#endif
+
+
 /** Changes the work directory.
  *  @param[in] dir path to new work directory
  *  @return true on success */

Modified: trunk/Build/source/texk/dvisvgm/dvisvgm-src/src/FileSystem.hpp
===================================================================
--- trunk/Build/source/texk/dvisvgm/dvisvgm-src/src/FileSystem.hpp	2022-01-08 18:39:01 UTC (rev 61532)
+++ trunk/Build/source/texk/dvisvgm/dvisvgm-src/src/FileSystem.hpp	2022-01-08 21:20:29 UTC (rev 61533)
@@ -48,6 +48,9 @@
 		static uint64_t filesize (const std::string &fname);
 		static std::string ensureForwardSlashes (std::string path);
 		static std::string getcwd ();
+#ifdef _WIN32
+		static std::string getcwd (char drive);
+#endif
 		static std::string tmpdir ();
 		static bool chdir (const std::string &dir);
 		static bool exists (const std::string &fname);



More information about the tex-live-commits mailing list.