Changeset 5850 in josm


Ignore:
Timestamp:
2013-04-14T00:42:40+02:00 (11 years ago)
Author:
Don-vip
Message:

fix #8602 - More detailed OS version info for Linux and Windows systems

Location:
trunk/src/org/openstreetmap/josm
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/data/Version.java

    r5839 r5850  
    153153    }
    154154
     155    /**
     156     * Initializes version info
     157     */
    155158    public void init() {
    156159        URL u = Main.class.getResource("/REVISION");
     
    209212    }
    210213
     214    /**
     215     * Returns the User-Agent string
     216     * @return The User-Agent
     217     */
    211218    public String getAgentString() {
    212219        int v = getVersion();
     
    218225            s += " SVN";
    219226        }
    220         return "JOSM/1.5 ("+ s+" "+LanguageInfo.getJOSMLocaleCode()+") " + System.getProperty("os.name");
     227        return "JOSM/1.5 ("+ s+" "+LanguageInfo.getJOSMLocaleCode()+") " + Main.platform.getOSDescription();
    221228    }
    222229}
  • trunk/src/org/openstreetmap/josm/tools/PlatformHook.java

    r4971 r5850  
    44import java.io.File;
    55import java.io.IOException;
    6 import java.util.HashMap;
    76
    87/**
     
    9392
    9493    public boolean rename(File from, File to);
     94   
     95    /**
     96     * Returns a detailed OS description (at least family + version).
     97     * @return A detailed OS description.
     98     * @since 5850
     99     */
     100    public String getOSDescription();
    95101}
  • trunk/src/org/openstreetmap/josm/tools/PlatformHookOsx.java

    r5450 r5850  
    250250        return false;
    251251    }
     252   
     253    /* (non-Javadoc)
     254     * @see org.openstreetmap.josm.tools.PlatformHookUnixoid#getOSDescription()
     255     */
     256    @Override
     257    public String getOSDescription() {
     258        return System.getProperty("os.name");
     259    }
    252260}
  • trunk/src/org/openstreetmap/josm/tools/PlatformHookUnixoid.java

    r5001 r5850  
    66import java.awt.GraphicsEnvironment;
    77import java.awt.event.KeyEvent;
     8import java.io.BufferedReader;
    89import java.io.File;
    910import java.io.IOException;
    10 import java.util.HashMap;
    11 
    12 import org.openstreetmap.josm.Main;
     11import java.io.InputStreamReader;
    1312
    1413/**
     
    8685        return from.renameTo(to);
    8786    }
     87
     88    @Override
     89    public String getOSDescription() {
     90        String osName = System.getProperty("os.name");
     91        if ("Linux".equalsIgnoreCase(osName)) {
     92            try {
     93                Process p = Runtime.getRuntime().exec("lsb_release -ds");
     94                BufferedReader input = new BufferedReader(new InputStreamReader(p.getInputStream()));
     95                String line = Utils.strip(input.readLine());
     96                input.close();
     97                if (line != null && !line.isEmpty()) {
     98                    return line;
     99                }
     100            } catch (IOException e) {
     101                e.printStackTrace();
     102            }
     103        }
     104        return osName;
     105    }
    88106}
  • trunk/src/org/openstreetmap/josm/tools/PlatformHookWindows.java

    r5355 r5850  
    1212import static java.awt.event.KeyEvent.VK_ENTER;
    1313import static java.awt.event.KeyEvent.VK_ESCAPE;
    14 import static java.awt.event.KeyEvent.VK_F1;
    1514import static java.awt.event.KeyEvent.VK_F10;
    1615import static java.awt.event.KeyEvent.VK_F4;
     
    124123        return from.renameTo(to);
    125124    }
     125
     126    /* (non-Javadoc)
     127     * @see org.openstreetmap.josm.tools.PlatformHookUnixoid#getOSDescription()
     128     */
     129    @Override
     130    public String getOSDescription() {
     131        return Utils.strip(System.getProperty("os.name")) + " " +
     132                ((System.getenv("ProgramFiles(x86)") == null) ? "32" : "64") + "-Bit";
     133    }
    126134}
Note: See TracChangeset for help on using the changeset viewer.