Skip to content

Commit e6a6019

Browse files
committed
Fix the cross-compilation for Windows
1 parent 55ae7d3 commit e6a6019

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

beacon_chain/networking/network_metadata.nim

+11-1
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,16 @@ import
2424
# TODO(zah):
2525
# We can compress the embedded states with snappy before embedding them here.
2626

27+
# ATTENTION! This file is intentionally avoiding the Nim `/` operator for
28+
# constructing paths. The standard operator is relying the `DirSep` constant
29+
# which depends on the selected target OS (when doing cross-compilation), so
30+
# the compile-time manipulation of paths performed here will break (e.g. when
31+
# cross-compiling for Windows from Linux)
32+
#
33+
# Nim seems to need a more general solution for detecting the host OS during
34+
# compilation, so a host OS specific separator can be used when deriving paths
35+
# from `currentSourcePath`.
36+
2737
export
2838
ethtypes, conversions, RuntimeConfig
2939

@@ -192,7 +202,7 @@ proc loadEth2NetworkMetadata*(path: string, eth1Network = none(Eth1Network)): Et
192202
proc loadCompileTimeNetworkMetadata(
193203
path: string,
194204
eth1Network = none(Eth1Network)): Eth2NetworkMetadata {.raises: [Defect].} =
195-
if fileExists(path / "config.yaml"):
205+
if fileExists(path & "/config.yaml"):
196206
try:
197207
result = loadEth2NetworkMetadata(path, eth1Network)
198208
if result.incompatible:

0 commit comments

Comments
 (0)