Update AppID documentation
This commit is contained in:
parent
956364b449
commit
e4b34d51d9
|
@ -8,8 +8,8 @@ _A platform-independent serial port access library for Java._
|
||||||
For usage examples, please refer to the [Usage wiki](https://github.com/Fazecast/jSerialComm/wiki/Usage-Examples).
|
For usage examples, please refer to the [Usage wiki](https://github.com/Fazecast/jSerialComm/wiki/Usage-Examples).
|
||||||
|
|
||||||
If you intend to use the library in multiple applications simultaneously, please make sure
|
If you intend to use the library in multiple applications simultaneously, please make sure
|
||||||
to set ```fazecast.jSerialComm.appid``` property before accessing the SerialPort class so that
|
to set the ```fazecast.jSerialComm.appid``` property before accessing the SerialPort class
|
||||||
applications don't accidentally delete each others temporary files during boot-up:
|
so that applications don't accidentally delete each others' temporary files during boot-up:
|
||||||
```
|
```
|
||||||
System.setProperty("fazecast.jSerialComm.appid", "YOUR_APPLICATION_IDENTIFIER")
|
System.setProperty("fazecast.jSerialComm.appid", "YOUR_APPLICATION_IDENTIFIER")
|
||||||
```
|
```
|
||||||
|
|
|
@ -51,9 +51,7 @@ public final class SerialPort
|
||||||
{
|
{
|
||||||
// Static initializer loads correct native library for this machine
|
// Static initializer loads correct native library for this machine
|
||||||
private static final String versionString = "2.7.0";
|
private static final String versionString = "2.7.0";
|
||||||
// Used to distinguish multiple processes running this lib
|
private static final String tmpdirAppIdProperty = "fazecast.jSerialComm.appid";
|
||||||
private static final String TMPDIR_APPID_PROPERTY = "fazecast.jSerialComm.appid";
|
|
||||||
|
|
||||||
private static volatile boolean isAndroid = false;
|
private static volatile boolean isAndroid = false;
|
||||||
private static volatile boolean isUnixBased = false;
|
private static volatile boolean isUnixBased = false;
|
||||||
private static volatile boolean isWindows = false;
|
private static volatile boolean isWindows = false;
|
||||||
|
@ -66,8 +64,8 @@ public final class SerialPort
|
||||||
if ((tempFileDirectory.charAt(tempFileDirectory.length()-1) != '\\') && (tempFileDirectory.charAt(tempFileDirectory.length()-1) != '/'))
|
if ((tempFileDirectory.charAt(tempFileDirectory.length()-1) != '\\') && (tempFileDirectory.charAt(tempFileDirectory.length()-1) != '/'))
|
||||||
tempFileDirectory += "/";
|
tempFileDirectory += "/";
|
||||||
|
|
||||||
// Make sure to use appId to separate tmpdir directories if library is used by multiple modules, so they don't erase each others folders accidentally.
|
// Make sure to use appId to separate tmpdir directories if library is used by multiple modules so they don't erase each others' folders
|
||||||
String appId = System.getProperty(TMPDIR_APPID_PROPERTY, "");
|
String appId = System.getProperty(tmpdirAppIdProperty, "");
|
||||||
tempFileDirectory += "jSerialComm/";
|
tempFileDirectory += "jSerialComm/";
|
||||||
if (!appId.isEmpty()) {
|
if (!appId.isEmpty()) {
|
||||||
tempFileDirectory += appId + (!appId.endsWith("/") ? "/" : "");
|
tempFileDirectory += appId + (!appId.endsWith("/") ? "/" : "");
|
||||||
|
|
Loading…
Reference in New Issue