Skip to content

Commit

Permalink
reactor: set DEFAULT_STATE_LOCATION_PATH to user.home (#328)
Browse files Browse the repository at this point in the history
* reactor: set DEFAULT_STATE_LOCATION_PATH to `user.home`
  • Loading branch information
Ahoo-Wang authored May 8, 2023
1 parent 6ea3097 commit 7802eb7
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.nio.file.Paths;

/**
* LocalMachine State Storage.
Expand All @@ -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) {
Expand Down Expand Up @@ -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);
}

Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 7802eb7

Please sign in to comment.