try swithing the current working directory when dropped into a Windows system folder.
This commit is contained in:
@ -25,8 +25,9 @@
|
|||||||
#endif
|
#endif
|
||||||
#include <io.h>
|
#include <io.h>
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#define isatty(x) _isatty(x)
|
#define chdir(x) _chdir(x)
|
||||||
#define getcwd(buf, len) _getcwd(buf, len)
|
#define getcwd(buf, len) _getcwd(buf, len)
|
||||||
|
#define isatty(x) _isatty(x)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if !defined(_WIN32)
|
#if !defined(_WIN32)
|
||||||
@ -673,6 +674,20 @@ int main(int argc, char **argv)
|
|||||||
char *line;
|
char *line;
|
||||||
std::string trimmed;
|
std::string trimmed;
|
||||||
|
|
||||||
|
// if current working directory is the "system folder"
|
||||||
|
// switch to the user's documents directory.
|
||||||
|
if (getcwd(buf, buflen)) {
|
||||||
|
if (strstr(buf, "System32")) {
|
||||||
|
char *drive = getenv("HOMEDRIVE");
|
||||||
|
char *path = getenv("HOMEPATH");
|
||||||
|
buf[0] = '\0';
|
||||||
|
if (drive) strcat(buf, drive);
|
||||||
|
if (path) strcat(buf, path);
|
||||||
|
strcat(buf, "\\Documents");
|
||||||
|
chdir(buf);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
lammps_get_os_info(buf, buflen);
|
lammps_get_os_info(buf, buflen);
|
||||||
std::cout << "LAMMPS Shell version 1.1 OS: " << buf;
|
std::cout << "LAMMPS Shell version 1.1 OS: " << buf;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user