Commit Graph

42 Commits

Author SHA1 Message Date
Le Philousophe 0a65e3724d COMMON: Don't escape base name if it wasn't escaped
And add a testcase for it.
2026-01-31 14:12:12 +01:00
Le Philousophe 3383edb038 COMMON: Add function to Path to know if path is Punycoded
Only the prefix is checked and Punycode correctness is not.
Only use this function with known paths.
2025-07-21 12:06:43 +02:00
Eugene Sandulenko 9b6414e94f COMMON: Implement Path::removeExtension() and relevant tests 2025-06-24 01:07:26 +02:00
Miro Kropáček df6a43d233 BACKENDS: ATARI: Introduce AtariFilesystemNode
Currently it only uses available OS/2 code for presenting disk drives in a nicer (and unified) way.
2025-05-23 18:39:08 +03:00
Filippos Karapetis 5b1e2d502c COMMON: Use C++ 11 range-based for loops 2025-03-27 13:47:57 +08:00
Filippos Karapetis 177f04349a COMMON: Use C++ 11 range-based for loops 2025-03-27 13:47:57 +08:00
Cameron Cawley 234dc99fd3 RISCOS: Don't encode path when it's not needed
Also disable atomic support as it may fail to write when file names are
long.
2024-12-04 22:41:14 +00:00
Cameron Cawley e8131bcc5c COMMON: Fix uninitialised variable in Path::punycodeNeedsEncode() 2024-12-04 22:36:47 +00:00
sluicebox db19c5a8c2 COMMON: Remove unreachable code
CID 1565716
2024-11-27 13:09:31 -08:00
Le Philousophe 234f3eb7f9 COMMON: Don't puny encode paths using UTF-8 but Latin-1
This avoids choking on invalid codepoints under Windows without
Unicode.
Latin-1 encoding has an identity mapping: every byte in the String will
get translated as-is in the U32String.

Don't modify punycodeDecode and punycodeEncode as the official
punyencoder uses unicode codepoints.
2024-11-15 09:37:18 +01:00
Le Philousophe 6678e1b5b1 COMMON: Avoid encoding paths if possible on all drive based platforms 2024-11-15 09:37:18 +01:00
Le Philousophe 0200a3d562 COMMON: Avoid punycoding of Win32 paths
Win32 paths contain a colon which triggers punycoding.
For Win32 UNICODE, paths are encoded in UTF-8 so there is not a real
need to puny-encode them anyway.
Only detect flagrant forbidden cases and store them the traditional way.

Without UNICODE support, the paths are provided in the system encoding.
Storing them as-is would make the configuration file mixing encodings.
For such paths don't punyencode if they don't need it after the drive
specifier.
2024-11-15 09:37:18 +01:00
Le Philousophe 93c68d38d4 COMMON: Allow to determine if a path needs punyencoding 2024-11-15 09:37:18 +01:00
Eugene Sandulenko c6daf24573 COMMON: Add Path::numComponents() method 2024-11-12 01:10:46 +01:00
Eugene Sandulenko c71697975a COMMON: Make the collision warnings unique
This fixes 3 equal warnings in different code branches, so the
rootcause could be identified more easily
2024-09-16 21:35:15 +02:00
Le Philousophe f675e643b8 COMMON: Add helper function to parse command-line provided paths 2024-06-15 02:07:38 +02:00
Le Philousophe b8e08ff2a0 COMMON: Fix Path::baseName
When baseName was called with a base name path but escaped, unescape was
called with the escaping marker while this is not allowed.
2024-05-19 21:18:34 +02:00
Le Philousophe aceaf99816 COMMON: Fix bug #14892
When both paths were equal, suffix was incremented one char too much and
went off the string.
Add test cases to check for this.
2024-02-02 08:06:59 +01:00
Le Philousophe 61b267759a COMMON: Use hashit, hashit_lower, equalsIgnoreCase on Path string
This change should be safe as our escape system doesn't mess with case.
In addition, we compare underlying strings to check equality so hashing
its content should work too.
2024-01-20 23:20:55 +01:00
Le Philousophe 4f1ccf0ef7 COMMON: Fix fromConfig not using the fixed path under Windows
Instead of using value_ it uses the untouched value.
2024-01-13 17:57:57 +01:00
Le Philousophe 3a80655b45 COMMON: Remove useless unary + in Path lambdas
This confuses poor old MSVC2015 and is not needed.
2024-01-01 11:22:45 +01:00
Le Philousophe 1722511c32 COMMON: Allow to store and fetch paths in configuration 2023-12-24 13:19:25 +01:00
Le Philousophe eeba7ca153 COMMON: Add more path functions 2023-12-24 13:19:25 +01:00
Le Philousophe 6f46727c77 COMMON: Check if string is puny encoded before trying to decode it
This avoids the following useless conversion String->U32String->String
while the content will not change.
2023-12-24 13:19:25 +01:00
Le Philousophe be7130f296 COMMON: Rework path storage 2023-12-24 13:19:25 +01:00
Le Philousophe 9260a58d6d COMMON: Make IgnoreCaseAndMac_EqualsTo name consistent with String
Use IgnoreCaseAndMac_EqualTo.
2023-12-24 13:19:25 +01:00
Le Philousophe f34bef6840 COMMON: Add normalization to Path class 2023-07-09 21:41:58 +02:00
Matthew Duggan c53b42311d COMMON: Fix path split+join combinations, add tests for same
This resolves multiple scenarios where a path ends up with a trailing
separator.
2022-12-31 17:57:07 +09:00
Vladimir Serbinenko 395aa10644 COMMON: Add missing escaping in Common::Path. 2022-12-20 10:04:55 +01:00
Vladimir Serbinenko 0979c692de COMMON: Add new method joinComponents 2022-12-16 22:59:34 +01:00
Vladimir Serbinenko a690a034cf COMMON: Remove reliance that \x1f is never part of filename
So far we never encountered such a case but mac disks are notorious for
having non-printable characters in names
2022-12-14 05:08:46 +01:00
Vladimir Serbinenko 673e5e025b COMMON: Remove rawString member for Common::Path 2022-12-14 05:08:46 +01:00
Vladimir Serbinenko 7ded5c2de0 COMMON: Move DIR_SEPARATOR into path.cpp 2022-12-14 05:08:46 +01:00
Vladimir Serbinenko 4a2e69f990 COMMON: conflate : and / in mac names.
When using mounted images on OSX or with fusehfs : and / are swapped.
When using dumper-companion it encodes / in punycode and preserves it.
2022-12-14 05:08:46 +01:00
Vladimir Serbinenko ab517cc577 COMMON: Add case-insensitive comparator and hash for Common::Path 2022-12-14 05:08:46 +01:00
Vladimir Serbinenko 43d7259ff9 COMMON: Add matchPattern method for Common::Path 2022-12-14 05:08:46 +01:00
Vladimir Serbinenko d02a25230d COMMON: Add appendComponent to Common::Path for convenience 2022-12-14 05:08:46 +01:00
Vladimir Serbinenko af7d9cb850 COMMON: Move punycode_*codepath to path.cpp
This allows to reduce access to DIR_SEPARATOR from outside of Common::Path
2022-12-14 05:08:46 +01:00
Thierry Crozat f2849282a6 Common: Add functions to decompose a Path into its components 2022-05-24 00:38:02 +02:00
Eugene Sandulenko abea37c9bb ALL: Update ScummVM project license to GPLv3+ 2021-12-26 18:48:43 +01:00
djsrv 763d2813a0 COMMON: Replace Path's += with append/join 2021-08-07 10:44:37 +02:00
djsrv 0db0b2c201 COMMON: Create Path type 2021-08-07 10:44:37 +02:00