Skip to content

Commit

Permalink
Make to work with windows, remove unnecessary config keys
Browse files Browse the repository at this point in the history
  • Loading branch information
DanWlker committed Jun 29, 2024
1 parent e66a9e2 commit 382f083
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion internal/app/edit/edit.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ func editTodoAssociatedWith(directory string) error {
}

var todoList []data.TodoEntity
for _, item := range strings.Split(string(result), "\n") {
for _, item := range strings.Split(strings.ReplaceAll(string(result), "\r\n", "\n"), "\n") {
if item != "" {
todoList = append(todoList, data.TodoEntity{Text: item})
}
Expand Down
5 changes: 3 additions & 2 deletions internal/config/config_keys.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package config

const DATA_FOLDER_KEY = "DATA_FOLDER_KEY"
const USER_DEFINED_DATA_FOLDER = "USER_DEFINED_DATA_FOLDER"
const LIST_AFTER_ADDING_TODO = "LIST_AFTER_ADDING_TODO"
const USER_DEFINED_HOME_PATH = "USER_DEFINED_HOME_PATH"
const LIST_AFTER_EDITING_TODO = "LIST_AFTER_EDITING_TODO"
const LIST_AFTER_REMOVING_TODO = "LIST_AFTER_REMOVING_TODO"
2 changes: 1 addition & 1 deletion internal/pkg/data/data.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ func WriteTodoToFile(dataFileFullPath string, todoList []TodoEntity) error {
}

func GetDataFolder() (string, error) {
dataFolder := strings.TrimSpace(viper.GetString(config.DATA_FOLDER_KEY))
dataFolder := strings.TrimSpace(viper.GetString(config.USER_DEFINED_DATA_FOLDER))
if dataFolder == "" {
home, errHomeDir := os.UserHomeDir()
if errHomeDir != nil {
Expand Down

0 comments on commit 382f083

Please sign in to comment.