bool PlatformLauncher::processAutoUpdateCL()

in src/main/cpp/bootstrap/platformlauncher.cpp [294:335]


bool PlatformLauncher::processAutoUpdateCL() {
    logMsg("processAutoUpdateCL()...");
    if (userDir.empty()) {
        logMsg("\tuserdir empty, quiting");
        return false;
    }
    string listPath = userDir;
    listPath += "\\update\\download\\netbeans.dirs";

    WIN32_FIND_DATA fd = {0};
    HANDLE hFind = 0;
    hFind = FindFirstFile(listPath.c_str(), &fd);
    if (hFind == INVALID_HANDLE_VALUE) {
        logMsg("File \"%s\" does not exist", listPath.c_str());
        return false;
    }
    FindClose(hFind);

    FILE *file = fopen(listPath.c_str(), "r");
    if (!file) {
        logErr(true, false, "Cannot open file %s", listPath.c_str());
        return false;
    }

    int len = fd.nFileSizeLow + 1;
    char *str = new char[len];
    if (!fgets(str, len, file)) {
        fclose(file);
        delete[] str;
        logErr(true, false, "Cannot read from file %s", listPath.c_str());
        return false;
    }
    len = strlen(str) - 1;
    if (str[len] == '\n') {
        str[len] = '\0';
    }

    auClusters = str;
    fclose(file);
    delete[] str;
    return true;
}