|
3 | 3 | +alias org.eolang.sm.os |
4 | 4 | +alias org.eolang.ss.list |
5 | 5 | +alias org.eolang.tt.regex |
6 | | -+alias org.eolang.tt.text |
| 6 | ++alias org.eolang.tt.index-of |
| 7 | ++alias org.eolang.tt.last-index-of |
| 8 | ++alias org.eolang.tt.replaced |
| 9 | ++alias org.eolang.tt.split |
7 | 10 | +architect yegor256@gmail.com |
8 | 11 | +home https://github.com/objectionary/eo |
9 | 12 | +package org.eolang.fs |
10 | | -+version 0.59.0 |
| 13 | ++version 0.59.1 |
11 | 14 | +spdx SPDX-FileCopyrightText: Copyright (c) 2016-2026 Objectionary.com |
12 | 15 | +spdx SPDX-License-Identifier: MIT |
13 | 16 | +unlint redundant-object:56 |
|
44 | 47 | posix joined-path |
45 | 48 | string > joined-path |
46 | 49 | as-bytes. |
47 | | - joined. |
48 | | - text separator |
| 50 | + QQ.tt.joined |
| 51 | + separator |
49 | 52 | paths |
50 | 53 |
|
51 | 54 | # POSIX specified path. |
|
79 | 82 | uri-as-bytes.size.plus -1 |
80 | 83 | 1 |
81 | 84 | separator |
82 | | - joined. > path |
83 | | - text separator |
| 85 | + QQ.tt.joined > path |
| 86 | + separator |
84 | 87 | reduced. |
85 | 88 | list |
86 | | - split. |
87 | | - text uri |
| 89 | + split |
| 90 | + uri |
88 | 91 | separator |
89 | 92 | * |
90 | 93 | [accum segment] >> |
|
176 | 179 | txt.length.minus |
177 | 180 | number slice-start-idx |
178 | 181 | uri > pth! |
179 | | - text > txt |
180 | | - string pth |
| 182 | + string pth > txt |
181 | 183 | plus. > slice-start-idx! |
182 | | - txt.last-index-of separator |
| 184 | + last-index-of txt separator |
183 | 185 | 1 |
184 | 186 |
|
185 | 187 | # Takes the extension part from the provided `path`, for example: |
|
209 | 211 | txt.length.minus |
210 | 212 | number slice-start-idx |
211 | 213 | basename > base! |
212 | | - text > txt |
213 | | - string base |
214 | | - txt.last-index-of "." > slice-start-idx! |
| 214 | + string base > txt |
| 215 | + last-index-of txt "." > slice-start-idx! |
215 | 216 |
|
216 | 217 | # Takes the directory name from the provided `path`, for example: |
217 | 218 | # |------------------------------|--------------------| |
|
239 | 240 | as-bytes. |
240 | 241 | txt.slice 0 len |
241 | 242 | uri > pth! |
242 | | - text > txt |
243 | | - string pth |
244 | | - txt.last-index-of separator > len! |
| 243 | + string pth > txt |
| 244 | + last-index-of txt separator > len! |
245 | 245 |
|
246 | 246 | # Windows specified path. |
247 | 247 | # Here `uri` is file system URI which may contain forward slashes '/'. |
|
280 | 280 | # Replaces slashes '/' with valid windows separator '\'. |
281 | 281 | [uri] > separated-correctly |
282 | 282 | if. > @ |
283 | | - (pth.index-of path.posix.separator).eq -1 |
| 283 | + (index-of pth path.posix.separator).eq -1 |
284 | 284 | string uri-as-bytes |
285 | | - string replaced |
| 285 | + string replaced-slash |
286 | 286 | uri > uri-as-bytes! |
287 | | - text > pth |
288 | | - string uri-as-bytes |
289 | | - pth.replaced > replaced! |
| 287 | + string uri-as-bytes > pth |
| 288 | + replaced > replaced-slash! |
| 289 | + pth |
290 | 290 | regex "/\\//" |
291 | 291 | separator |
292 | 292 |
|
|
331 | 331 | uri-as-bytes.size.plus -1 |
332 | 332 | 1 |
333 | 333 | separator |
334 | | - joined. > path! |
335 | | - text separator |
| 334 | + QQ.tt.joined > path! |
| 335 | + separator |
336 | 336 | reduced. |
337 | 337 | list |
338 | | - split. |
339 | | - text driveless |
| 338 | + split |
| 339 | + driveless |
340 | 340 | ^.separator |
341 | 341 | * |
342 | 342 | [accum segment] >> |
|
453 | 453 | txt.length.minus |
454 | 454 | number slice-start-idx |
455 | 455 | uri > pth! |
456 | | - text > txt |
457 | | - string pth |
| 456 | + string pth > txt |
458 | 457 | plus. > slice-start-idx! |
459 | | - txt.last-index-of separator |
| 458 | + last-index-of txt separator |
460 | 459 | 1 |
461 | 460 |
|
462 | 461 | # Takes the extension part from the provided `path`, for example: |
|
486 | 485 | txt.length.minus |
487 | 486 | number slice-start-idx |
488 | 487 | basename > base! |
489 | | - text > txt |
490 | | - string base |
491 | | - txt.last-index-of "." > slice-start-idx! |
| 488 | + string base > txt |
| 489 | + last-index-of txt "." > slice-start-idx! |
492 | 490 |
|
493 | 491 | # Takes the directory name from the provided `path`, for example: |
494 | 492 | # |------------------------------|--------------------| |
|
512 | 510 | as-bytes. |
513 | 511 | txt.slice 0 len |
514 | 512 | uri > pth! |
515 | | - text > txt |
516 | | - string pth |
517 | | - txt.last-index-of separator > len! |
| 513 | + string pth > txt |
| 514 | + last-index-of txt separator > len! |
518 | 515 |
|
519 | 516 | # Tests that the path separator is determined correctly based on the operating system. |
520 | 517 | [] +> tests-determines-separator-depending-on-os |
|
0 commit comments