1
0
Fork 0
mirror of synced 2025-09-23 12:18:44 +00:00

fix import resolving issue with absolute paths

This commit is contained in:
dark64 2020-07-16 11:10:13 +02:00
parent bf591d595a
commit ab811a0d0b
2 changed files with 9 additions and 1 deletions

View file

@ -25,7 +25,12 @@ describe('tests', function() {
it('should resolve stdlib module', function() {
assert.doesNotThrow(() => {
const code = 'import "hashes/sha256/512bit" as sha256\ndef main() -> (): return';
const code = `
import "hashes/sha256/512bit" as sha256
import "ecc/edwardsAdd" as edwardsAdd
def main() -> ():
return
`;
this.zokrates.compile(code, "main");
})
});

View file

@ -1,4 +1,7 @@
const getAbsolutePath = (basePath, relativePath) => {
if (relativePath[0] !== '.') {
return relativePath;
}
var stack = basePath.split('/');
var chunks = relativePath.split('/');
stack.pop();