Skip to content

Commit daa5643

Browse files
authored
Merge pull request #91 from fahad-israr/windows-patch-config
Create .config if not exist
2 parents 8ed1433 + d64d9b0 commit daa5643

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

cli/src/main/java/dev/starfix/Starfix.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,13 @@ public static boolean isWindows() {
124124
// Function to fetch config file
125125
public static File getConfigFile() {
126126
String userHome = System.getProperty("user.home"); // Get User Home Directory: /home/user_name
127+
File configDir = new File(userHome+ "/.config");
127128

129+
if(!configDir.exists()){ // If .config directory does not exist we create it
130+
if(!configDir.mkdirs()){ // If creation failed
131+
throw new IllegalStateException("Cannot create .config directory: " + configDir.getAbsolutePath());
132+
}
133+
}
128134
return new File(userHome + "/.config/starfix.yaml");
129135

130136
}

0 commit comments

Comments
 (0)