94 Commits

Author SHA1 Message Date
Jeroen van Rijn
7a9ea3ee6d Further overhaul of package line comments. 2025-10-09 23:05:29 +02:00
Jeroen van Rijn
2bc409eab5 More package lines. 2025-10-09 20:40:13 +02:00
Wrath
443b6e1641 Unify filepath.join behavior on between unix/windows 2025-09-23 23:03:20 -04:00
gingerBill
bb4bc316a4 for in string16; Support string16 across core 2025-08-02 12:20:35 +01:00
sergeypdev
2fc8ca6cf5 Disable filepath/match.odin and filepath/walk.odin compilation on js
targets
2025-07-19 16:44:45 +04:00
Jeroen van Rijn
ae5c92ac38 Enable odin check examples/all for JS. 2025-06-04 11:08:25 +02:00
Laytan Laats
e4892f1bb2 os/os2: wasi target support 2025-01-18 22:23:44 +01:00
avanspector
0a985f5d02 Haiku: small fixes across core 2025-01-10 07:07:40 +01:00
gingerBill
ee76acd665 Merge pull request #4427 from laytan/posix-additions
Finish sys/posix with Linux and partial Windows support & clean up other packages as a result
2024-10-30 11:43:47 +00:00
Laytan
0b4a4212bb clean up dynlib and path/filepath with sys/posix 2024-10-28 19:21:16 +01:00
gingerBill
35d818bb4e Fix possible leak in recursive filepath.glob 2024-10-27 12:10:10 +00:00
Karl Zylinski
19f0127e55 Moved all packages in core, base, vendor, tests and examples to use new #+ file tag syntax. 2024-09-14 18:27:49 +02:00
gingerBill
31bb3dc4f0 Merge pull request #3971 from jasonKercher/os2-process-linux
os2 process linux implementation
2024-08-16 12:38:27 +01:00
jason
07a9c69714 update core:filepath's clean, join and split_list to return optional Allocator_Errors 2024-08-16 01:48:27 -04:00
Laytan Laats
efe68c2e24 posix: add package 2024-08-14 01:44:35 +02:00
gingerBill
93fabf8628 Replace err != 0 with err != nil where possible 2024-08-04 14:57:25 +01:00
gingerBill
97c499dbb4 Begin mapping os.Error in the rest of the codebase 2024-08-04 11:58:04 +01:00
gingerBill
1d75a612d5 os.Errno -> os.Error 2024-08-04 11:47:23 +01:00
gingerBill
9f9abb8fb3 Use union #shared_nil for os.Error 2024-08-04 11:05:30 +01:00
gingerBill
e296d6fb90 Fix loads of indentation issues with mixing spaces and tabs 2024-06-29 19:50:51 +01:00
Feoramund
c68560c573 Use correct __error link name for FreeBSD 2024-06-11 03:55:41 -04:00
Andreas T Jonsson
38640d5d9e Updated core lib and did cleanup
Updated core with some path related functions and did some minor code cleanup.
Most of the standard library function is just a matter of copy what is there for the other BSDs.
2024-04-18 10:12:42 +02:00
gingerBill
4035a226da Fix filepath.rel allocation behaviour 2024-02-06 23:39:20 +00:00
gingerBill
9a16bc5fc5 Remove core:os dependency for base:runtime 2024-01-28 22:40:46 +00:00
gingerBill
3e7e779abf Replace core:* to base:* where appropriate 2024-01-28 22:18:51 +00:00
Jesse Stiller
3bd1918c5e Fixed typo "fot" and clarified slashpath.ext 2023-10-30 11:57:44 +10:00
gingerBill
14adcb9db8 Use or_break and or_continue where appropriate in the core library 2023-09-30 15:34:39 +01:00
gingerBill
49ab935ae9 Disallow for in in favour of for _ in 2023-08-08 14:56:12 +01:00
gingerBill
025fc2685d Add docs to core:path/filepath 2023-02-28 12:55:13 +00:00
gingerBill
986cba584e Add runtime.DEFAULT_TEMP_ALLOCATOR_TEMP_GUARD where appropriate 2023-02-10 16:23:33 +00:00
gingerBill
f9f4551e8d Add user_data: rawptr to filepath.Walk_Proc callback 2022-12-05 22:31:35 +00:00
Daniel Gavin
25869b7504 Change open to be read only when opening directory 2022-07-25 11:34:03 +02:00
Tetralux
3a8adc6721 [path/slashpath] Change join() to take a slice instead of varargs
Achieves parity with filepath.join(), which was similarly changed a while back.
2022-07-21 17:49:31 +00:00
Tetralux
06884da42b [path/filepath] Change join() to take a []string instead of varargs
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)`
2022-05-21 04:48:06 +00:00
gingerBill
dc832ad49f Minor fix 2022-05-12 13:20:55 +01:00
Tetralux
b44b6e7e50 [path/filepath] Add file stem and long-extension procedures
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'
2022-04-23 20:25:59 +00:00
Jeroen van Rijn
df32b5b46c [windows] Fix leak in glob. 2022-03-29 16:13:17 +02:00
gitlost
374e71e9b0 Fix issue #1537 "filepath.split_list requires a trailing separator"
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"
2022-03-23 17:44:35 +00:00
Sébastien Marie
5676c9e7eb initial OpenBSD support 2022-02-25 08:49:25 +00:00
Patric Dexheimer
d7eabf571c Memory Leak
`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.
2022-02-20 02:10:34 -03:00
gingerBill
f5697dd7f2 Merge branch 'master' into odin-global-constants-as-enums 2022-02-15 15:47:24 +00:00
CiD-
83e9a6b417 fix -vet for filepath/match.odin 2022-02-08 09:21:43 -05:00
Platin21
8b1100bf2b os.open does r/d as default which makes a call to open a dir invalid this should fix this problem 2022-02-05 23:12:55 +01:00
gingerBill
3d7d347192 Convert ODIN_OS and ODIN_ARCH to use enums rather than use strings 2022-01-20 19:56:05 +00:00
gingerBill
1d293749c2 Move core:path to core:path/slashpath
This is to reduce the confusion that occurs between that package and the `core:path/filepath` package
2022-01-17 11:38:15 +00:00
Dale Weiler
a55f0cfb63 fix memory leak in path.join 2021-11-22 10:25:54 -05:00
gingerBill
ceebd7b23c Correct context.allocator usage 2021-09-19 11:59:31 +01:00
gingerBill
ca33cb990b Strip semicolons in core which were missing 2021-09-08 13:12:38 +01:00
gingerBill
251da264ed Remove unneeded semicolons from the core library 2021-08-31 22:21:13 +01:00
gingerBill
4035fec784 Add more uses of or_return 2021-08-15 18:13:56 +01:00