Add support for relative pathnames to JSC config files
https://bugs.webkit.org/show_bug.cgi?id=169154
Reviewed by Saam Barati.
If the config file is a relative path, prepend the current working directory.
After canonicalizing the config file path, we extract its directory path and
use that for the directory for a relative log pathname.
* runtime/ConfigFile.cpp:
(JSC::ConfigFile::ConfigFile):
(JSC::ConfigFile::parse):
(JSC::ConfigFile::canonicalizePaths):
* runtime/ConfigFile.h:
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@213399 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/Source/JavaScriptCore/runtime/ConfigFile.h b/Source/JavaScriptCore/runtime/ConfigFile.h
index a8964f4..10f60dc 100644
--- a/Source/JavaScriptCore/runtime/ConfigFile.h
+++ b/Source/JavaScriptCore/runtime/ConfigFile.h
@@ -25,6 +25,8 @@
#pragma once
+#include <limits.h>
+
namespace JSC {
class ConfigFile {
@@ -36,10 +38,19 @@
JS_EXPORT_PRIVATE void parse();
private:
+ void canonicalizePaths();
+
+#if PLATFORM(WIN)
+ static const size_t s_maxPathLength = 260; // Windows value for "MAX_PATH"
+#else
+ static const size_t s_maxPathLength = PATH_MAX;
+#endif
+
static char s_processName[];
static char s_parentProcessName[];
- const char* m_filename;
+ char m_filename[s_maxPathLength + 1];
+ char m_configDirectory[s_maxPathLength + 1];
};
} // namespace JSC