Skip to content

Commit

Permalink
Merge pull request #34 from codeyarduk/show-file-tree
Browse files Browse the repository at this point in the history
minor bug fixes
  • Loading branch information
davidwrossiter authored Dec 9, 2024
2 parents ee723df + e3917f4 commit dfda409
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
10 changes: 9 additions & 1 deletion cmd/mordecai/fileManagement.go
Original file line number Diff line number Diff line change
Expand Up @@ -259,8 +259,16 @@ type FileContent struct {

func getFileContents(files []string) ([]FileContent, error) {
var fileContents []FileContent
currentDir, err := os.Getwd()
if err != nil {
return nil, fmt.Errorf("error getting current directory: %v", err)
}
baseDir := filepath.Base(currentDir)

for _, filePath := range files {

relPath, err := filepath.Rel(currentDir, filePath)
fullRelPath := filepath.Join(baseDir, relPath)
// Check if it's a regular file
info, err := os.Stat(filePath)
if err != nil {
Expand Down Expand Up @@ -289,7 +297,7 @@ func getFileContents(files []string) ([]FileContent, error) {
}

fileContents = append(fileContents, FileContent{
FilePath: filePath,
FilePath: fullRelPath,
DataChunks: content,
FileExtension: ext,
})
Expand Down
2 changes: 1 addition & 1 deletion cmd/mordecai/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
)

const (
version = "v0.0.36"
version = "v0.0.37"

githubAPI = "https://api.github.com/repos/codeyarduk/mordecai/releases/latest"
)
Expand Down
1 change: 1 addition & 0 deletions test.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
aetliilkajetlkajeltk

0 comments on commit dfda409

Please sign in to comment.