Skip to content

Commit a1d9272

Browse files
author
Fahad Israr
committed
Create .config if not exist
1 parent eac1b81 commit a1d9272

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
@@ -122,7 +122,13 @@ public static boolean isWindows() {
122122
// Function to fetch config file
123123
public static File getConfigFile() {
124124
String userHome = System.getProperty("user.home"); // Get User Home Directory: /home/user_name
125+
File configDir = new File(userHome+ "/.config");
125126

127+
if(!configDir.exists()){ // If .config directory does not exist we create it
128+
if(!configDir.mkdir()){ // If creation failed
129+
throw new IllegalArgumentException("Cannot create .config directory: " + configDir.getAbsolutePath());
130+
}
131+
}
126132
return new File(userHome + "/.config/starfix.yaml");
127133

128134
}

0 commit comments

Comments
 (0)