This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

View | Details | Raw Unified | Return to bug 86555
Collapse All | Expand All

(-)subversion/main/src/org/netbeans/modules/subversion/config/SvnConfigFiles.java (-33 / +5 lines)
Lines 30-36 Link Here
30
import java.util.Collection;
30
import java.util.Collection;
31
import java.util.Iterator;
31
import java.util.Iterator;
32
import java.util.List;
32
import java.util.List;
33
import java.util.Properties;
34
import java.util.StringTokenizer;
33
import java.util.StringTokenizer;
35
import org.ini4j.Ini;
34
import org.ini4j.Ini;
36
import org.netbeans.modules.subversion.util.FileUtils;
35
import org.netbeans.modules.subversion.util.FileUtils;
Lines 848-861 Link Here
848
     *
847
     *
849
     */
848
     */
850
    private static String getAPPDATA() {
849
    private static String getAPPDATA() {
850
        String appdata = "";
851
        if(Utilities.isWindows()) {
851
        if(Utilities.isWindows()) {
852
            String appdata = System.getProperty("Env-APPDATA"); // should work on XP // NOI18N
852
            appdata = System.getenv("APPDATA");// NOI18N
853
            if(appdata == null || appdata.trim().equals("")) { // NOI18N
854
                appdata = getWindowsProperty("APPDATA"); // NOI18N
855
            }
856
            return appdata;
857
        }
853
        }
858
        return ""; // NOI18N
854
        return appdata!= null? appdata: "";
859
    }
855
    }
860
856
861
    /**
857
    /**
Lines 864-872 Link Here
864
     */
860
     */
865
    private static String getGlobalAPPDATA() {
861
    private static String getGlobalAPPDATA() {
866
        if(Utilities.isWindows()) {
862
        if(Utilities.isWindows()) {
867
            String globalProfile = System.getProperty("Env-ALLUSERSPROFILE"); // should work on XP  // NOI18N
863
            String globalProfile = System.getenv("ALLUSERSPROFILE");                       // NOI18N
868
            if(globalProfile == null || globalProfile.trim().equals("")) {                          // NOI18N
864
            if(globalProfile == null || globalProfile.trim().equals("")) {                          // NOI18N
869
                globalProfile = getWindowsProperty("ALLUSERSPROFILE");                              // NOI18N
865
                globalProfile = "";
870
            }
866
            }
871
            String appdataPath = WINDOWS_USER_APPDATA;
867
            String appdataPath = WINDOWS_USER_APPDATA;
872
            if(appdataPath == null || appdataPath.equals("")) {                                     // NOI18N
868
            if(appdataPath == null || appdataPath.equals("")) {                                     // NOI18N
Lines 887-916 Link Here
887
            }
883
            }
888
            return globalProfile + "/" + appdata;                                                   // NOI18N
884
            return globalProfile + "/" + appdata;                                                   // NOI18N
889
        }
885
        }
890
        return "";                                                                                  // NOI18N
891
    }
892
    
893
    /**
894
     * Returns a the value for the given specified windows env variable
895
     */
896
    private static String getWindowsProperty(String propertyKey) {
897
        Process p = null;
898
        Properties propVals = new Properties();
899
        Runtime r = Runtime.getRuntime();
900
        try {
901
            p = r.exec("cmd /C set");                                                               // NOI18N
902
            BufferedReader br = new BufferedReader(new InputStreamReader(p.getInputStream()));
903
            String line;
904
            while((line = br.readLine()) != null) {
905
                int index = line.indexOf('=');
906
                String key = line.substring(0, index);
907
                String value = line.substring(index + 1);
908
                propVals.setProperty(key, value);
909
            }    
910
            return propVals.getProperty(propertyKey);
911
        } catch (Exception e) {
912
            ErrorManager.getDefault().notify(e); 
913
        } 
914
        return "";                                                                                  // NOI18N
886
        return "";                                                                                  // NOI18N
915
    }
887
    }
916
    
888
    

Return to bug 86555