void resolveLauncherProperties()

in src/main/cpp/launcher/windows/src/Launcher.c [419:455]


void resolveLauncherProperties(LauncherProperties * props, WCHAR **result) {
    if(*result != NULL) {
        WCHAR * propStart = searchW(*result, L"$L{");
        if(propStart!=NULL) {
            WCHAR * propEnd = searchW(propStart + 3, L"}");
            if(propEnd!=NULL) {
                WCHAR * propName = appendStringNW(NULL, 0, propStart + 3 , getLengthW(propStart + 3) - getLengthW(propEnd));
                if(propName!=NULL) {
                    WCHAR * propValue = NULL;
                    
                    if(lstrcmpW(propName, L"nbi.launcher.tmp.dir")==0) {
                        propValue = appendStringW(NULL, props->tmpDir); // launcher tmpdir
                    } else if(lstrcmpW(propName, L"nbi.launcher.java.home")==0) {
                        if(props->java!=NULL) {
                            propValue  = appendStringW(NULL, props->java->javaHome); // relative to javahome
                        }
                    } else if(lstrcmpW(propName, L"nbi.launcher.user.home")==0) {
                        propValue = getCurrentUserHome();
                    } else if(lstrcmpW(propName, L"nbi.launcher.parent.dir")==0) {
                        propValue = appendStringW(NULL, props->exeDir); // launcher parent
                    }
                    
                    
                    if(propValue!=NULL) {
                        WCHAR * tmp = appendStringNW(NULL, 0, *result, getLengthW(*result) - getLengthW(propStart));
                        tmp = appendStringW(tmp, propValue);
                        tmp = appendStringW(tmp, propEnd + 1);                        
                        FREE(*result);
                        FREE(propValue);
                        *result = tmp;
                    }
                }
            }
        }
    }
    
}