Trace on Windows requires admin permissions (and fails)

IPlugLogger.h creates a Trace file on the root of the C drive on Windows:

  char logFilePath[100];
  #ifdef OS_WIN
      sprintf(logFilePath, "%s/%s", "C:\\", LOGFILE); // TODO: check windows logFilePath
  #else
      sprintf(logFilePath, "%s/%s", getenv("HOME"), LOGFILE);
  #endif
      mFP = fopen(logFilePath, "w");

Unfortunately on Windows, writing to root directories requires administrator privileges. MSVC opens without them by default, so the file creation fails.

Writing to a subdirectory, eg. C:\Plug2 works without admin (ideally the code should create the directory first if needed).

here’s a quick hack that works:

  #ifdef OS_WIN
      const char* path = "C:/iPlug2";
      CreateDirectory(path, NULL);
      sprintf(logFilePath, "%s/%s", path, LOGFILE);

For bug/issues GitHub is best, because everything is tracked. If you have a fix, then a PR makes it easiest to incorporate changes.

Thanks