Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove filepath.Walk while opening file #152

Closed
AlexanderMatveev opened this issue Feb 14, 2025 · 3 comments · Fixed by #154
Closed

Remove filepath.Walk while opening file #152

AlexanderMatveev opened this issue Feb 14, 2025 · 3 comments · Fixed by #154
Assignees
Labels
enhancement New feature or request

Comments

@AlexanderMatveev
Copy link

Is your feature request related to a problem? Please describe.
I have directory hierarchy with files have same name, why file opening performs with filepath.Walk?

Describe the solution you'd like
Remove file tree walking https://github.com/Valentin-Kaiser/go-dbase/blob/main/dbase/io_generic.go#L642

@Valentin-Kaiser
Copy link
Owner

Hi,
Could you clarify if you are experiencing an actual issue with filepath.Walk, or if this is just a suggestion for optimization?

We use filepath.Walk because we have use cases where files may have the same name but differ in case sensitivity. To ensure we correctly locate these files, we first scan the directory structure.

If you are encountering a specific problem with this approach, please let us know so we can investigate further.

@AlexanderMatveev
Copy link
Author

Hi, Could you clarify if you are experiencing an actual issue with filepath.Walk, or if this is just a suggestion for optimization?

We use filepath.Walk because we have use cases where files may have the same name but differ in case sensitivity. To ensure we correctly locate these files, we first scan the directory structure.

If you are encountering a specific problem with this approach, please let us know so we can investigate further.

Here is example of project structure:

main.go
data/dir1/file.dbf
data/dir2/file.dbf

The problem is when I load file.dbf, I can't control which one is loaded.
And by the way filepath.Walk works in ./ directory, it's possible to pass data/dir1/main.go and it tries to load main.go.

@Valentin-Kaiser
Copy link
Owner

Thank you for your suggestion. I understand that this approach may lead to unintended behavior in such scenarios.
To address this, I will review the current implementation and consider modifying the file opening process. However, I will still try to open files in a case-insensitive manner to maintain compatibility across different filesystems.

I appreciate your feedback and will work on improving the file handling accordingly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
2 participants