Skip to content

Commit

Permalink
Merge pull request #13 from MohamTahaB/Fix/create-md-dir
Browse files Browse the repository at this point in the history
Fix/create-md-dir
  • Loading branch information
MohamTahaB authored Mar 20, 2024
2 parents 169e8fb + c16dbf0 commit 46bd869
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions jotter/storage/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,11 @@ func InitiateStorage() (string, string, error) {
// TODO! for now, if one of the dirs do not exist, everything will be set anew. This should change to accomodate all possible edge cases.

// Create the dirs if one of them do not exist.
if err = os.MkdirAll(filepath.Dir(dir), 0755); err != nil {
// The mds dir is enough as it is the most ramified one.
if err = os.MkdirAll(filepath.Clean(dir), 0755); err != nil {
return "", "", fmt.Errorf("error creating .md directory: %v", err)
}

if err = os.MkdirAll(filepath.Dir(JSONDir), 0755); err != nil {
return "", "", fmt.Errorf("error creating JSON file directory : %v", err)
}

// Create the JSON file.
if _, JSONErr = os.Create(JSONDir); JSONErr != nil {
return "", "", fmt.Errorf("error creating JSON file: %v", JSONErr)
Expand Down

0 comments on commit 46bd869

Please sign in to comment.