Commit 5884d2e4 authored by Billy Hulbert's avatar Billy Hulbert
Browse files

Run the boot directory check a little earlier

parent adf2ef94
Loading
Loading
Loading
Loading
+13 −13
Original line number Diff line number Diff line
@@ -70,6 +70,19 @@ int main(int argc, const char* argv[])
        nScriptFilePathLength = static_cast<UINT32>(wcslen(szScriptFilePath));
    }

    //
    // Create boot directory if we need to
    //
    DWORD dwAttributes = GetFileAttributesW(g_szDefaultBootPath);
    if (dwAttributes == INVALID_FILE_ATTRIBUTES) {
        BOOL bRes = CreateDirectoryW(g_szDefaultBootPath, NULL);
        if (bRes != TRUE) {
            wprintf(L"Failed to create directory: %s\nLast result: %d\n", g_szDefaultBootPath, GetLastError());
            return 1;
        }
        printf("Created boot directory.\n");
    }

    if (bUseUSB) {
        boolean bUsbScriptExists = false;

@@ -104,19 +117,6 @@ int main(int argc, const char* argv[])
        return hResult;
    }

    //
    // Create boot directory if we need to
    //
    DWORD dwAttributes = GetFileAttributesW(g_szDefaultBootPath);
    if (dwAttributes == INVALID_FILE_ATTRIBUTES) {
        BOOL bRes = CreateDirectoryW(g_szDefaultBootPath, NULL);
        if (bRes != TRUE) {
            wprintf(L"Failed to create directory: %s\nLast result: %d\n", g_szDefaultBootPath, GetLastError());
            return 1;
        }
        printf("Created boot directory.\n");
    }

    HSTRING_HEADER hStrHdr2;
    hResult = WindowsCreateStringReference(szScriptFilePath, nScriptFilePathLength, &hStrHdr2, &hStrScriptPath);
    if (hResult != S_OK) {