パスの扱い方を呼び出し元でシンプルになるように変更

This commit is contained in:
studiokaiji
2023-11-09 06:26:32 +09:00
parent ea85ed4a60
commit 9baa230836
2 changed files with 2 additions and 4 deletions

View File

@@ -23,13 +23,12 @@ func FindFilesWithBasePathBySuffixes(basePath string, suffixes []string) ([]stri
// ファイル名とサフィックスがマッチした場合
if strings.HasSuffix(strings.ToLower(info.Name()), strings.ToLower(suffix)) {
// フルパスからbasePathまでの相対パスを計算
relPath, err := filepath.Rel(basePath, path)
if err != nil {
fmt.Println("❌ Error calculating relative path:", err)
continue
}
// マッチするファイルの相対パスをスライスに追加
filePaths = append(filePaths, "/"+relPath)
filePaths = append(filePaths, path)
break
}
}