You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by pa...@apache.org on 2021/08/06 03:25:27 UTC

[shardingsphere] branch master updated: Refactor default persist path for LocalDistMetaDataPersistRepository (#11674)

This is an automated email from the ASF dual-hosted git repository.

panjuan pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/shardingsphere.git


The following commit(s) were added to refs/heads/master by this push:
     new f36d2a2  Refactor default persist path for LocalDistMetaDataPersistRepository (#11674)
f36d2a2 is described below

commit f36d2a28b7fa30fba80f3b833f76ce6bac1f97f3
Author: Haoran Meng <me...@gmail.com>
AuthorDate: Fri Aug 6 11:25:01 2021 +0800

    Refactor default persist path for LocalDistMetaDataPersistRepository (#11674)
---
 .../persist/repository/local/LocalDistMetaDataPersistRepository.java | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/config/persist/repository/local/LocalDistMetaDataPersistRepository.java b/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/config/persist/repository/local/LocalDistMetaDataPersistRepository.java
index ba484e6..0590ac0 100644
--- a/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/config/persist/repository/local/LocalDistMetaDataPersistRepository.java
+++ b/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/config/persist/repository/local/LocalDistMetaDataPersistRepository.java
@@ -17,6 +17,7 @@
 
 package org.apache.shardingsphere.infra.config.persist.repository.local;
 
+import com.google.common.base.Joiner;
 import com.google.common.base.Strings;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.shardingsphere.infra.config.persist.repository.DistMetaDataPersistRepository;
@@ -38,6 +39,8 @@ import java.util.stream.Collectors;
 @Slf4j
 public final class LocalDistMetaDataPersistRepository implements DistMetaDataPersistRepository {
     
+    private static final String DEFAULT_PERSIST_DIRECTORY = ".shardingsphere";
+    
     private String path;
     
     @Override
@@ -96,6 +99,6 @@ public final class LocalDistMetaDataPersistRepository implements DistMetaDataPer
     public void setProps(final Properties props) {
         LocalRepositoryProperties localRepositoryProperties = new LocalRepositoryProperties(props);
         path = Optional.ofNullable(Strings.emptyToNull(localRepositoryProperties.getValue(LocalRepositoryPropertyKey.PATH)))
-                .orElse(System.getProperty("user.dir"));
+                .orElse(Joiner.on("/").join(System.getProperty("user.home"), DEFAULT_PERSIST_DIRECTORY));
     }
 }