diff --git a/neverwinter.nimble b/neverwinter.nimble index 86b25c3..996b6e4 100644 --- a/neverwinter.nimble +++ b/neverwinter.nimble @@ -6,8 +6,8 @@ description = "Neverwinter Nights 1: Enhanced Edition data accessor library an license = "MIT" requires "nim >= 1.6.4" -requires "checksums" when NimMajor == 2: + requires "checksums" requires "https://github.com/docopt/docopt.nim#head" requires "db_connector >= 0.1.0" else: diff --git a/neverwinter/erf.nim b/neverwinter/erf.nim index 992c4aa..175a5b1 100644 --- a/neverwinter/erf.nim +++ b/neverwinter/erf.nim @@ -1,6 +1,6 @@ -import streams, strutils, tables, times, algorithm, logging, checksums/sha1, std/oids +import streams, strutils, tables, times, algorithm, logging, std/oids -import resman, util, resref, exo, compressedbuf +import resman, util, resref, exo, compressedbuf, checksums # This is advisory only. We will emit a warning on mismatch (so library users # get more debug hints), but still attempt to load the file. diff --git a/neverwinter/key.nim b/neverwinter/key.nim index 01084c0..4f6dbbd 100644 --- a/neverwinter/key.nim +++ b/neverwinter/key.nim @@ -1,7 +1,7 @@ -import streams, sequtils, strutils, tables, times, os, sets, math, checksums/sha1, std/oids +import streams, sequtils, strutils, tables, times, os, sets, math, std/oids doAssert(($genOid()).len == 24) -import resman, util, compressedbuf, exo +import resman, util, compressedbuf, exo, checksums # bif and key version NEEDS to match type KeyBifVersion* {.pure.} = enum diff --git a/neverwinter/nwsync.nim b/neverwinter/nwsync.nim index 4a6e79f..a91344a 100644 --- a/neverwinter/nwsync.nim +++ b/neverwinter/nwsync.nim @@ -2,7 +2,7 @@ import std/[streams, critbits, os, algorithm, strutils, sequtils, math, options] import neverwinter/restype, neverwinter/resref, neverwinter/streamext -import checksums/sha1 +import checksums # Bit of a hack, sorry: always print securehash in lowercase proc `$`*(s: SecureHash): string = diff --git a/neverwinter/resman.nim b/neverwinter/resman.nim index 5d7915b..45ccd37 100644 --- a/neverwinter/resman.nim +++ b/neverwinter/resman.nim @@ -16,10 +16,10 @@ ## inherits from ResConainer and then creating the required methods (see below). -import options, streams, sets, times, strutils, checksums/sha1 +import options, streams, sets, times, strutils export options, streams, sets -import resref, restype, util, lru, exo, compressedbuf +import resref, restype, util, lru, exo, compressedbuf, checksums export resref, restype const MemoryCacheThreshold* = 1024 * 1024 # 1MB diff --git a/neverwinter/resnwsync.nim b/neverwinter/resnwsync.nim index db0992d..221129c 100644 --- a/neverwinter/resnwsync.nim +++ b/neverwinter/resnwsync.nim @@ -1,12 +1,12 @@ import std/streams, std/tables, std/os, std/sequtils, std/strutils, std/times, std/logging, - checksums/sha1, std/hashes + std/hashes when NimMajor == 2: import db_connector/db_sqlite else: import std/db_sqlite -import resman, compressedbuf +import resman, compressedbuf, checksums const NWSyncCompressedBufMagicStr* = "NSYC" const NWSyncCompressedBufMagic* = makeMagic(NWSyncCompressedBufMagicStr) diff --git a/nwn_erf.nim b/nwn_erf.nim index d3d3046..913bdd2 100644 --- a/nwn_erf.nim +++ b/nwn_erf.nim @@ -1,4 +1,4 @@ -import shared, checksums/sha1, std/oids +import shared, checksums, std/oids let args = DOC """ Un/packs erf files. diff --git a/nwn_erf_tlkify.nim b/nwn_erf_tlkify.nim index 0244c11..2d0d8a8 100644 --- a/nwn_erf_tlkify.nim +++ b/nwn_erf_tlkify.nim @@ -1,4 +1,4 @@ -import shared, checksums/sha1, std/oids +import shared, checksums, std/oids import critbits, os, tables, options, sets, sequtils, strutils, logging diff --git a/nwn_key_pack.nim b/nwn_key_pack.nim index bc446db..646c68c 100644 --- a/nwn_key_pack.nim +++ b/nwn_key_pack.nim @@ -1,4 +1,4 @@ -import shared, checksums/sha1 +import shared, checksums let args = DOC """ This utility packs a .key file and all associated bifs from directory tree. diff --git a/nwn_resman_grep.nim b/nwn_resman_grep.nim index d9c5f05..99fcdcd 100644 --- a/nwn_resman_grep.nim +++ b/nwn_resman_grep.nim @@ -1,4 +1,4 @@ -import shared, checksums/sha1, checksums/md5 +import shared, checksums let args = DOC """ Find files in resman diff --git a/nwn_resman_pkg.nim b/nwn_resman_pkg.nim index 9af8d20..9e4f2ea 100644 --- a/nwn_resman_pkg.nim +++ b/nwn_resman_pkg.nim @@ -1,4 +1,4 @@ -import shared, checksums/sha1 +import shared, checksums const ServerPackageExtensions = [ # walkmeshes: needed to pathfind diff --git a/private/checksums.nim b/private/checksums.nim new file mode 100644 index 0000000..48c09fd --- /dev/null +++ b/private/checksums.nim @@ -0,0 +1,6 @@ +when NimMajor == 2: + import checksums/[sha1, md5] +else: + import std/[sha1, md5] + +export sha1, md5