aboutsummaryrefslogtreecommitdiff
path: root/core/path
Commit message (Collapse)AuthorAgeFilesLines
* [path/filepath] Change join() to take a []string instead of varargsTetralux2022-05-213-3/+3
| | | | | | | | | This makes passing an allocator easier, as you no longer have to resort to named arguments: Before: `join(a, b, c)` became `join(elems={a, b, c}, allocator=ally)` After: `join({a, b, c})` becomes `join({a, b, c}, ally)`
* Minor fixgingerBill2022-05-121-1/+1
|
* [path/filepath] Add file stem and long-extension proceduresTetralux2022-04-231-9/+124
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Adds stem(), short_stem(), and long_ext(); also adds doc-comments to base() and ext(). The 'stem' is usually 'the name' of the file; the basename without the file extension. To this end, this adds stem(), which is such that: stem(path) + ext(path) = base(path) However, 'file extension' has two different meanings to what constitutes it! > What is the extension of: 'name.tar.gz' ? Colloquially, you would likely think of it as 'a tarball' - which you might think is '.tar.gz'. But, if you're writing code to process a file of this type, you would first treat it as a Gzip file, and then treat the result as a TAR file - i.e: '.gz' ... _followed by_ '.tar'. ext() returns '.gz' here, since that is the most-immediate format that you would need to use to decode it; it would be a Gzip stream. Sometimes though, you do actually want to consider these longer file extensions. Perhaps you're extracting a tarball, and what to know what to call the intermediate tar file; perhaps you want to check to see if this file is a tarball, or just a Gzip file; or maybe you just want 'the name' of the file, and not this "strange 'name-and-part-of-the-extension' thing". So, this also adds short_stem() and long_ext(), such that: short_stem(path) + long_ext(path) = base(path) Thus, we can use either, but the most immediately-useful one is the easiest to reach for: stem('name.tar.gz') -> 'name.tar' ext('name.tar.gz') -> '.gz' short_stem('name.tar.gz') -> 'name' long_ext('name.tar.gz') -> '.tar.gz' These procedures are identical to their counterparts when the path only has a simple extension: stem('name.txt') -> 'name' ext('name.txt') -> '.txt' short_stem('name.txt') -> 'name' long_ext('name.txt') -> '.txt'
* [windows] Fix leak in `glob`.Jeroen van Rijn2022-03-292-5/+11
|
* Fix issue #1537 "filepath.split_list requires a trailing separator"gitlost2022-03-231-2/+8
| | | | | | Does `make()` with `count + 1` and appends final component (note a trailing separator will now result in an empty final component) Adds test "tests/core/path/filepath/test_core_filepath.odin"
* initial OpenBSD supportSébastien Marie2022-02-251-1/+6
|
* Memory LeakPatric Dexheimer2022-02-201-2/+3
| | | `dir` will leak memory if u use it with allocators that don´t care in freeing the memory at the end ( like arenas or the temp_allocator ) , because `strings.clone` and `strings.concatenate` are not using the passed allocator.
* Merge branch 'master' into odin-global-constants-as-enumsgingerBill2022-02-152-3/+2
|\
| * fix -vet for filepath/match.odinCiD-2022-02-081-2/+1
| |
| * os.open does r/d as default which makes a call to open a dir invalid this ↵Platin212022-02-051-1/+1
| | | | | | | | should fix this problem
* | Convert `ODIN_OS` and `ODIN_ARCH` to use enums rather than use stringsgingerBill2022-01-203-9/+9
|/
* Move `core:path` to `core:path/slashpath`gingerBill2022-01-173-3/+8
| | | | This is to reduce the confusion that occurs between that package and the `core:path/filepath` package
* fix memory leak in path.joinDale Weiler2021-11-221-1/+1
|
* Correct `context.allocator` usagegingerBill2021-09-191-4/+5
|
* Strip semicolons in core which were missinggingerBill2021-09-081-17/+17
|
* Remove unneeded semicolons from the core librarygingerBill2021-08-316-472/+472
|
* Add more uses of `or_return`gingerBill2021-08-151-4/+1
|
* Core library clean up: Make range expressions more consistent and replace ↵gingerBill2021-06-141-1/+1
| | | | uses of `..` with `..=`
* Fix linalg.transposegingerBill2021-06-031-1/+0
|
* Or did it?!gingerBill2021-06-021-2/+2
|
* FINALLY fix `lazy_buffer_destroy`gingerBill2021-06-021-2/+2
|
* Fix filepath.lazy_buffergingerBill2021-06-021-2/+3
|
* Clean up filepath.lazy_buffer memory leakgingerBill2021-06-021-1/+7
|
* Fix accidental removal of newlinejockus2021-05-271-0/+1
|
* Remove accidental core:fmt include in path/filepathjockus2021-05-271-1/+0
|
* Fix deleting substring in filepath.releasejockus2021-05-271-8/+8
|
* fix variable name in path_unixAndré2021-04-201-2/+2
| | | replace the immutable variable "path" (that is a parameter) with a new variable "path_str"
* Clean up path_unix.odin to make it not depend on `package os`gingerBill2021-04-111-6/+38
|
* Update package os for package path/filepath support on macOSgingerBill2021-02-273-81/+93
|
* Replace usage of `inline proc` with `#force_inline proc` in the core librarygingerBill2021-02-231-2/+2
|
* * Add some procedures to path_unix to mirror the path_windows APILuka Aleksić2021-01-212-8/+30
| | | | | * Add files stat_linux and dir_linux to mirror the stat/dir_windows API * Add helper functions to os_linux that are used by the above
* vet all core packagesgingerBill2021-01-091-2/+0
|
* Keep -vet happygingerBill2020-12-143-9/+9
|
* Update `odin doc` to support multiple package outputs by passing multiple ↵gingerBill2020-11-181-2/+0
| | | | | | | paths; Replace `-all` with `-short` Example: odin doc core/path core/path/filepath
* Minor fixesgingerBill2020-11-171-1/+2
|
* Merge pull request #752 from powerc9000/patch-4gingerBill2020-10-241-2/+2
|\ | | | | Fix a few bugs in path based code.
| * Fix a few bugs in path based code.Clay Murray2020-10-071-2/+2
| | | | | | Trying to use path.dir and path.rel I found these two issues with the implementation.
* | Rename `slice.sort_proc` to `slice.sort_by`; add `slice.sort_by_key`gingerBill2020-10-162-2/+2
| |
* | Update path/filepath to use new `slice.sort`; Add `sort.reverse_interface`gingerBill2020-10-142-6/+6
| |
* | Improve default temp allocator; Fix filepath.abs behaviour on WindowsgingerBill2020-10-132-11/+13
|/
* Revert `user_data` additiongingerBill2020-09-281-8/+8
|
* Add `user_data` parameter to `filepath.walk` and `filepath.Walk_Proc`gingerBill2020-09-281-8/+8
|
* Add `filepath.walk`gingerBill2020-09-281-0/+88
|
* Add `os.stat`, `os.lstat`, `os.fstat`, `filepath.walk`gingerBill2020-09-282-3/+5
|
* Add some comments to explain what the differences between packages path and ↵gingerBill2020-09-262-0/+7
| | | | path/filepath
* Remove OS specific stuff from `package path`gingerBill2020-09-261-147/+7
|
* Update packages os, path, and filepathgingerBill2020-09-265-216/+258
|
* Add `package path/filepath`; Add `os.stat` for windows (TODO: unix)gingerBill2020-09-255-12/+637
|
* Update `package path` and fix bugs; add path.match which uses shell pattern ↵gingerBill2020-09-254-59/+428
| | | | matching
* Remove usage of `do` in core librarygingerBill2020-09-233-12/+30
|