Commit graph

19 commits

Author SHA1 Message Date
Joey Hess
0f47eceacf
stop exporting RawFilePath 2025-02-12 12:59:30 -04:00
Joey Hess
2ff716be30
OsPath build flag no longer depends on filepath-bytestring
However, filepath-bytestring is still in Setup-Depends.
That's because Utility.OsPath uses it when not built with OsPath.
It would be maybe possible to make Utility.OsPath fall back to using
filepath, and eliminate that dependency too, but it would mean either
wrapping all of System.FilePath's functions, or using `type OsPath = FilePath`

Annex.Import uses ifdefs to avoid converting back to FilePath when not
on windows. On windows it's a bit slower due to that conversion.
Utility.Path.Windows.convertToWindowsNativeNamespace got a bit
slower too, but not really worth optimising I think.

Note that importing Utility.FileSystemEncoding at the same time as
System.Posix.ByteString will result in conflicting definitions for
RawFilePath. filepath-bytestring avoids that by importing RawFilePath
from System.Posix.ByteString, but that's not possible in
Utility.FileSystemEncoding, since Setup-Depends does not include unix.
This turned out not to affect any code in git-annex though.

Sponsored-by: Leon Schuermann
2025-02-10 16:39:55 -04:00
Joey Hess
20ed039d59
don't export pack and unpack
These are too widly used for other things to make sense to export OsPath
versions of them. And OsString also provides them and gets imported
qualified when needed.
2025-02-10 12:34:13 -04:00
Joey Hess
2d1db7986c
more OsPath conversion (572/749)
Sponsored-by: Jack Hill
2025-02-06 16:18:52 -04:00
Joey Hess
4dc904bbad
more OsPath conversion
Sponsored-by: Leon Schuermann
2025-02-04 16:09:47 -04:00
Joey Hess
c309edb8fb
Merge branch 'master' into ospath 2025-01-29 15:37:19 -04:00
Joey Hess
1b7293fb67
fix windows build 2025-01-29 15:36:41 -04:00
Joey Hess
4d7bdd0047
windows build fix 2025-01-29 14:59:00 -04:00
Joey Hess
4e999af7ac
fix windows build and clarify comment 2025-01-29 14:52:20 -04:00
Joey Hess
76bff3e8d1
Merge branch 'master' into ospath 2025-01-29 14:29:34 -04:00
Joey Hess
2940cfcd18
fix fromOsPath on windows
Same reasons as 9c9baf7c65
2025-01-29 14:19:25 -04:00
Joey Hess
9c9baf7c65
fix toOsPath on windows
After recent changes to use OsPath, test suite fails on windows with:

Exception: Uneven number of bytes: 5. This is not a Word16 bytestream.

Hopefully this fixes it. The innefficiency of the conversion is
unfortunate.
2025-01-29 14:06:54 -04:00
Joey Hess
98a0a9ddff
optimise literalOsPath
Taking a ShortByteString and using OverloadedStrings should avoid it
being converted from a String.

The reason there is no IsString instance for OsPath is presumably the
bad behavior of IsString for ByteString on unicode btw. But
literalOsPath won't be used with unicode in git-annex.

Sponsored-by: unqueued
2025-01-27 16:36:29 -04:00
Joey Hess
aa0f3f31da
more OsPath conversion
Sponsored-by: Eve
2025-01-24 15:02:29 -04:00
Joey Hess
c3c8870752
add System.FilePath to this conversion
It seems to make sense to convert both System.Directory and
System.FilePath uses to OsPath in one go. This will generally look like
replacing RawFilePath with OsPath in type signatures, and will be driven
by the now absolutely massive pile of compile errors.

Got a few modules building in this new regime.

Sponsored-by: Jack Hill
2025-01-23 11:07:29 -04:00
Joey Hess
05bdce328d
start converting from System.Directory to System.OsPath
This is the start of a long road, got the first few files to compile
after this large change.

Sponsored-by: mycroft
2025-01-23 10:25:20 -04:00
Joey Hess
793ddecd4b
use openTempFile from file-io
And follow-on changes.

Note that relatedTemplate was changed to operate on a RawFilePath, and
so when it counts the length, it is now the number of bytes, not the
number of code points. This will just make it truncate shorter strings
in some cases, the truncation is still unicode aware.

When not building with the OsPath flag, toOsPath . fromRawFilePath and
fromRawFilePath . fromOsPath do extra conversions back and forth between
String and ByteString. That overhead could be avoided, but that's the
non-optimised build mode, so didn't bother.

Sponsored-by: unqueued
2025-01-22 11:41:43 -04:00
Joey Hess
1faa3af9cd
add file-io to build-depends when building with OsPath flag
Partly converted code to use functions from it, though more remain
unconverted. Most of withFile and openFile now use it.
2025-01-21 14:26:04 -04:00
Joey Hess
71f83bfff7
rename OsString to OsPath 2025-01-21 11:57:44 -04:00
Renamed from Utility/OsString.hs (Browse further)