added starfix to work without default config#99
added starfix to work without default config#99maxandersen merged 4 commits intostarfixdev:masterfrom zedbeit:starfix-default-config
Conversation
|
|
||
| @Command(name = "clone") | ||
| public int cloneCmd(@Parameters(index = "0") String url) { | ||
| String userHome = System.getProperty("user.home"); // Get User Home Directory: /home/user_name |
There was a problem hiding this comment.
Should use getConfigFile instead of duplicating logic for lookup?
There was a problem hiding this comment.
changed to use getConfigFile.
There was a problem hiding this comment.
I noticed that the getConfigFile creates ".config" directory, which won't be useful, that's why i didn't use it.
There was a problem hiding this comment.
I think its a mistake we have getconfigfile create it - should split it up so we have one to get the file/path without creating it.
There was a problem hiding this comment.
Made some changes. What do yo think?
| clone_path = System.getProperty("user.home") + "/code"; // set clone_path to /home/user_name/code | ||
| File configFile = getConfigFile(); | ||
|
|
||
| try { | ||
| configFile.createNewFile(); | ||
|
|
||
| if(isWindows()){// check if Windows OS | ||
| if(path_env.contains("Microsoft VS Code")){ // If PATH has VScode | ||
| ide = "code.cmd"; | ||
| writeToYAMLFile(ide, clone_path,configFile); | ||
| } else if(path_env.contains("IntelliJ IDEA")){ // If PATH has IntelliJ | ||
| ide = "idea64.exe"; | ||
| writeToYAMLFile(ide, clone_path,configFile); | ||
| } |
There was a problem hiding this comment.
We shouldn't have to write the default config to disk. Then it by definition is no longer a default.
There was a problem hiding this comment.
Avoided writing to disk.
| // if(isMac()){} | ||
|
|
||
| } catch (Exception e) { | ||
| e.printStackTrace(); |
There was a problem hiding this comment.
we shuoldn't just be printing stacktrace. is this try/catch even needed?
| defaultConfig(); | ||
| } | ||
| } catch (Exception e) { | ||
| e.printStackTrace(); |
There was a problem hiding this comment.
should not print stakctraces raw to the user. and what do we expect that can throw an exception here?
There was a problem hiding this comment.
I thought the code block might throw an exception, but I've fixed that now.
|
|
||
| } | ||
|
|
||
| // Function to load default config |
There was a problem hiding this comment.
it does not load anything ,right ? it just setups default configuration.
There was a problem hiding this comment.
Yeah it just sets up default config.
| } | ||
|
|
||
| // Function to load default config | ||
| public void defaultConfig() { |
There was a problem hiding this comment.
no need for this to be public.
maxandersen
left a comment
There was a problem hiding this comment.
general approach is sound enough - avoids storing file just to get a default config.
but a few issues around exception handling we should fix.
Made starfix to work without config on windows and provide implementations for two IDEs, VScode and IntelliJ.