MCPcopy Create free account
hub / github.com/FirebirdSQL/firebird / getTempPath

Method getTempPath

src/common/classes/TempFile.cpp:88–118  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

86//
87
88PathName TempFile::getTempPath()
89{
90 const char* env_temp = getenv(ENV_VAR);
91 PathName path = env_temp ? env_temp : "";
92 if (path.empty())
93 {
94#if defined(WIN_NT)
95 char temp_dir[MAXPATHLEN];
96 // this checks "TEMP" and "TMP" environment variables
97 const int len = GetTempPath(sizeof(temp_dir), temp_dir);
98 if (len && len < sizeof(temp_dir))
99 {
100 path = temp_dir;
101 }
102#else
103 env_temp = getenv("TMP");
104 path = env_temp ? env_temp : "";
105#endif
106 }
107 if (path.empty())
108 {
109 const char* tmp = getTemporaryFolder();
110 if (tmp)
111 path = tmp;
112 else
113 path = DEFAULT_PATH;
114 }
115
116 fb_assert(path.length());
117 return path;
118}
119
120//
121// TempFile::create

Callers

nothing calls this directly

Calls 3

getTemporaryFolderFunction · 0.85
emptyMethod · 0.45
lengthMethod · 0.45

Tested by

no test coverage detected