Araq / ormin

Ormin -- An ORM for Nim.
MIT License
152 stars 18 forks source link

Compilation fails when trying ormin nimble package #2

Closed ghost closed 6 years ago

ghost commented 6 years ago

I get this error in my code: notesapp.nim(3, 31) Error: cannot open 'notes_model' But before that there is another warning: fatal: cannot open $USER/.nimble/pkgs/ormin-#head/ormin.nim/notes_model.sql

ghost commented 6 years ago

It is caused because of a bug in currentSourcePath(). If two modules ormin.nim:

template t*: untyped =
   echo currentSourcePath()

and app.nim:

import ormin
t()

it outputs the first's module path. It works if we call instantiationInfo(-1, true).filename directly.

ghost commented 6 years ago

note that even when reverting the last commit and doing:

import ormin
importModel(sqlite, currentSourcePath(), "notes_model")

still gives wrong result: fatal: cannot open /home/username/nim/src/notesapp.nim/notes_model.sql

Araq commented 6 years ago

Sorry for this rather late reply, but I'm actively working on a good real world Ormin+Karax example that documents its usage (and limitations).

ghost commented 6 years ago

Sure no worries. You have a lot of staff to maintain. Besides I already had a workaround.