You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by il...@apache.org on 2019/09/02 10:28:21 UTC

[ignite] branch master updated: IGNITE-12103 Change fallback work dir to ignite/work, put README.txt in ignite/ - Fixes #6816.

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

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


The following commit(s) were added to refs/heads/master by this push:
     new df0eb16  IGNITE-12103 Change fallback work dir to ignite/work, put README.txt in ignite/ - Fixes #6816.
df0eb16 is described below

commit df0eb1636989d94f3974b2a7a45ebfa0d26cc2e9
Author: Ilya Kasnacheev <il...@gmail.com>
AuthorDate: Mon Sep 2 13:24:36 2019 +0300

    IGNITE-12103 Change fallback work dir to ignite/work, put README.txt in ignite/ - Fixes #6816.
    
    Signed-off-by: Ilya Kasnacheev <il...@gmail.com>
---
 .../apache/ignite/internal/util/IgniteUtils.java   | 23 +++++++++++++++++++++-
 1 file changed, 22 insertions(+), 1 deletion(-)

diff --git a/modules/core/src/main/java/org/apache/ignite/internal/util/IgniteUtils.java b/modules/core/src/main/java/org/apache/ignite/internal/util/IgniteUtils.java
index 01c55b2..c6dfc56 100755
--- a/modules/core/src/main/java/org/apache/ignite/internal/util/IgniteUtils.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/util/IgniteUtils.java
@@ -9330,7 +9330,28 @@ public abstract class IgniteUtils {
                         IgniteSystemProperties.IGNITE_WORK_DIR + ") must be explicitly set."
                 );
 
-            workDir = new File(userDir, DEFAULT_WORK_DIR);
+            File igniteDir = new File(userDir, "ignite");
+
+            try {
+                igniteDir.mkdirs();
+
+                File readme = new File(igniteDir, "README.txt");
+
+                if (!readme.exists()) {
+                    U.writeStringToFile(readme,
+                        "This is Apache Ignite working directory that contains information that \n" +
+                        "    Ignite nodes need in order to function normally.\n" +
+                        "Don't delete it unless you're sure you know what you're doing.\n\n" +
+                        "You can change the location of working directory with \n" +
+                        "    igniteConfiguration.setWorkingDirectory(location) or \n" +
+                        "    <property name=\"workingDirectory\" value=\"location\"/> in IgniteConfiguration <bean>.\n");
+                }
+            }
+            catch (Exception e) {
+                // Ignore.
+            }
+
+            workDir = new File(igniteDir, DEFAULT_WORK_DIR);
         }
 
         if (!workDir.isAbsolute())