changed the compiler's path handling; fixes #546
This commit is contained in:
parent
1e5926458c
commit
893be3a5a4
11 changed files with 32 additions and 17 deletions
|
|
@ -262,15 +262,7 @@ proc processPath(path: string, info: TLineInfo,
|
||||||
else:
|
else:
|
||||||
options.gProjectPath / path
|
options.gProjectPath / path
|
||||||
try:
|
try:
|
||||||
result = unixToNativePath(p % ["nimrod", getPrefixDir(),
|
result = pathSubs(p, info.toFullPath().splitFile().dir)
|
||||||
"nim", getPrefixDir(),
|
|
||||||
"lib", libpath,
|
|
||||||
"home", removeTrailingDirSep(os.getHomeDir()),
|
|
||||||
"config", info.toFullPath().splitFile().dir,
|
|
||||||
"projectname", options.gProjectName,
|
|
||||||
"projectpath", options.gProjectPath])
|
|
||||||
if '~' in result:
|
|
||||||
result = result.replace("~", os.getHomeDir())
|
|
||||||
except ValueError:
|
except ValueError:
|
||||||
localError(info, "invalid path: " & p)
|
localError(info, "invalid path: " & p)
|
||||||
result = p
|
result = p
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,11 @@ proc getModuleName*(n: PNode): string =
|
||||||
# The proc won't perform any checks that the path is actually valid
|
# The proc won't perform any checks that the path is actually valid
|
||||||
case n.kind
|
case n.kind
|
||||||
of nkStrLit, nkRStrLit, nkTripleStrLit:
|
of nkStrLit, nkRStrLit, nkTripleStrLit:
|
||||||
result = unixToNativePath(n.strVal)
|
try:
|
||||||
|
result = pathSubs(n.strVal, n.info.toFullPath().splitFile().dir)
|
||||||
|
except ValueError:
|
||||||
|
localError(n.info, "invalid path: " & n.strVal)
|
||||||
|
result = n.strVal
|
||||||
of nkIdent:
|
of nkIdent:
|
||||||
result = n.ident.s
|
result = n.ident.s
|
||||||
of nkSym:
|
of nkSym:
|
||||||
|
|
|
||||||
|
|
@ -242,7 +242,7 @@ proc mainCommand* =
|
||||||
clearPasses()
|
clearPasses()
|
||||||
gLastCmdTime = epochTime()
|
gLastCmdTime = epochTime()
|
||||||
appendStr(searchPaths, options.libpath)
|
appendStr(searchPaths, options.libpath)
|
||||||
if gProjectFull.len != 0:
|
when false: # gProjectFull.len != 0:
|
||||||
# current path is always looked first for modules
|
# current path is always looked first for modules
|
||||||
prependStr(searchPaths, gProjectPath)
|
prependStr(searchPaths, gProjectPath)
|
||||||
setId(100)
|
setId(100)
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,7 @@ path:"$projectPath/.."
|
||||||
path:"$lib/packages/docutils"
|
path:"$lib/packages/docutils"
|
||||||
|
|
||||||
define:booting
|
define:booting
|
||||||
import:testability
|
#import:"$projectpath/testability"
|
||||||
|
|
||||||
@if windows:
|
@if windows:
|
||||||
cincludes: "$lib/wrappers/libffi/common"
|
cincludes: "$lib/wrappers/libffi/common"
|
||||||
|
|
|
||||||
|
|
@ -242,6 +242,21 @@ proc getNimcacheDir*: string =
|
||||||
result = if nimcacheDir.len > 0: nimcacheDir else: gProjectPath.shortenDir /
|
result = if nimcacheDir.len > 0: nimcacheDir else: gProjectPath.shortenDir /
|
||||||
genSubDir
|
genSubDir
|
||||||
|
|
||||||
|
|
||||||
|
proc pathSubs*(p, config: string): string =
|
||||||
|
let home = removeTrailingDirSep(os.getHomeDir())
|
||||||
|
result = unixToNativePath(p % [
|
||||||
|
"nim", getPrefixDir(),
|
||||||
|
"lib", libpath,
|
||||||
|
"home", home,
|
||||||
|
"config", config,
|
||||||
|
"projectname", options.gProjectName,
|
||||||
|
"projectpath", options.gProjectPath,
|
||||||
|
"projectdir", options.gProjectPath,
|
||||||
|
"nimcache", getNimcacheDir()])
|
||||||
|
if '~' in result:
|
||||||
|
result = result.replace("~", home)
|
||||||
|
|
||||||
template newPackageCache(): expr =
|
template newPackageCache(): expr =
|
||||||
newStringTable(when FileSystemCaseSensitive:
|
newStringTable(when FileSystemCaseSensitive:
|
||||||
modeCaseInsensitive
|
modeCaseInsensitive
|
||||||
|
|
|
||||||
|
|
@ -2514,7 +2514,7 @@ template newException*(exceptn: typedesc, message: string): expr =
|
||||||
e
|
e
|
||||||
|
|
||||||
when hostOS == "standalone":
|
when hostOS == "standalone":
|
||||||
include panicoverride
|
include "$projectpath/panicoverride"
|
||||||
|
|
||||||
when not declared(sysFatal):
|
when not declared(sysFatal):
|
||||||
when hostOS == "standalone":
|
when hostOS == "standalone":
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
import
|
import
|
||||||
sfml, chipmunk,
|
sfml, chipmunk,
|
||||||
sg_assets, sfml_stuff, keineschweine
|
sg_assets, sfml_stuff, "../keineschweine"
|
||||||
|
|
||||||
|
|
||||||
proc accel*(obj: PVehicle, dt: float) =
|
proc accel*(obj: PVehicle, dt: float) =
|
||||||
|
|
|
||||||
|
|
@ -1,2 +1,3 @@
|
||||||
# this file only exists to mark 'main.nim' as the main file
|
# this file only exists to mark 'main.nim' as the main file
|
||||||
|
|
||||||
|
--path:"$projectpath"
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
import
|
import
|
||||||
tri_engine/config,
|
../config,
|
||||||
tri_engine/math/vec
|
vec
|
||||||
|
|
||||||
type
|
type
|
||||||
TCircle* = tuple[p: TV2[TR], r: TR]
|
TCircle* = tuple[p: TV2[TR], r: TR]
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
import
|
import
|
||||||
macros,
|
macros,
|
||||||
tri_engine/config
|
"../config"
|
||||||
|
|
||||||
type
|
type
|
||||||
TV2*[T:SomeNumber=TR] = array[0..1, T]
|
TV2*[T:SomeNumber=TR] = array[0..1, T]
|
||||||
|
|
|
||||||
|
|
@ -42,6 +42,9 @@ Changes affecting backwards compatibility
|
||||||
- The procs related to ``random`` number generation in ``math.nim`` have
|
- The procs related to ``random`` number generation in ``math.nim`` have
|
||||||
been moved to its own ``random`` module and been reimplemented in pure
|
been moved to its own ``random`` module and been reimplemented in pure
|
||||||
Nim.
|
Nim.
|
||||||
|
- The path handling changed. The project directory is not added to the
|
||||||
|
search path automatically anymore. Add this line to your project's
|
||||||
|
config to get back the old behaviour: ``--path:"$projectdir"``.
|
||||||
|
|
||||||
|
|
||||||
Library Additions
|
Library Additions
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue