Package com.stuffwithstuff.magpie

Examples of com.stuffwithstuff.magpie.SourceFile


   
    Module module = mModules.get(name);
   
    // Only load it once.
    if (module == null) {
      SourceFile info = mHost.loadModule(name);
      module = new Module(name, info, this);
      mModules.put(name, module);
     
      evaluateModule(module);
    }
View Full Code Here


        System.out.print(right);
        return null;
      }
    });
   
    String result = magpie.run(new SourceFile(path, script));
    if (result != null) {
      System.out.println(result);
    }
  }
View Full Code Here

      String modulePath = name.replace('.', '/');

      // $CWD/foo/bar.mag
      File file = new File(modulePath + ".mag");
      if (file.exists()) {
        return new SourceFile(file.getPath(), readFile(file.getPath()));
      }
     
      // $CWD/foo/bar/_init.mag
      file = new File(modulePath + "/_init.mag");
      if (file.exists()) {
        return new SourceFile(file.getPath(), readFile(file.getPath()));
      }
     
      // $APPDIR/lib/foo/bar.mag
      File appDir = new File(getAppDirectory(), "lib");
      file = new File(appDir, modulePath + ".mag");
      if (file.exists()) {
        return new SourceFile(file.getPath(), readFile(file.getPath()));
      }
     
      // $APPDIR/lib/foo/bar/_init.mag
      file = new File(appDir, modulePath + "/_init.mag");
      if (file.exists()) {
        return new SourceFile(file.getPath(), readFile(file.getPath()));
      }

      throw new IOException("Couldn't find module " + name);
    } catch (IOException e) {
      e.printStackTrace();
View Full Code Here

TOP

Related Classes of com.stuffwithstuff.magpie.SourceFile

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.