diff --git a/cosid-core/src/main/java/me/ahoo/cosid/machine/LocalMachineStateStorage.java b/cosid-core/src/main/java/me/ahoo/cosid/machine/LocalMachineStateStorage.java index 8510f39575..6eeb1d042d 100644 --- a/cosid-core/src/main/java/me/ahoo/cosid/machine/LocalMachineStateStorage.java +++ b/cosid-core/src/main/java/me/ahoo/cosid/machine/LocalMachineStateStorage.java @@ -26,6 +26,7 @@ import java.io.File; import java.io.FileOutputStream; import java.io.IOException; +import java.nio.file.Paths; /** * LocalMachine State Storage. @@ -34,7 +35,7 @@ */ @Slf4j public class LocalMachineStateStorage implements MachineStateStorage { - public static final String DEFAULT_STATE_LOCATION_PATH = "./cosid-machine-state/"; + public static final String DEFAULT_STATE_LOCATION_PATH = Paths.get(System.getProperty("user.home"), ".cosid-machine-state").toString(); public final String stateLocation; public LocalMachineStateStorage(String stateLocation) { @@ -87,7 +88,7 @@ private File getStateFile(String namespace, InstanceId instanceId) { } String fileName = namespace + "__" + instanceId.getInstanceId(); String encodedName = BaseEncoding.base64().encode(fileName.getBytes(Charsets.UTF_8)); - String statePath = stateLocation + encodedName; + String statePath = Paths.get(stateLocation, encodedName).toString(); return new File(statePath); } diff --git a/gradle.properties b/gradle.properties index 729a0e4cb8..e04f134c80 100644 --- a/gradle.properties +++ b/gradle.properties @@ -12,7 +12,7 @@ # group=me.ahoo.cosid -version=1.19.0 +version=1.19.1 description=Universal, flexible, high-performance distributed ID generator. website=https://github.com/Ahoo-Wang/CosId