本文整理汇总了Java中play.vfs.VirtualFile.open方法的典型用法代码示例。如果您正苦于以下问题:Java VirtualFile.open方法的具体用法?Java VirtualFile.open怎么用?Java VirtualFile.open使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类play.vfs.VirtualFile
的用法示例。
在下文中一共展示了VirtualFile.open方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: addModule
import play.vfs.VirtualFile; //导入方法依赖的package包/类
/**
* Add a play application (as plugin)
*
* @param path The application path
*/
public static void addModule(String name, File path) {
VirtualFile root = VirtualFile.open(path);
modules.put(name, root);
if (root.child("app").exists()) {
javaPath.add(root.child("app"));
}
if (root.child("app/views").exists()) {
templatesPath.add(root.child("app/views"));
}
if (root.child("conf/routes").exists()) {
modulesRoutes.put(name, root.child("conf/routes"));
}
roots.add(root);
if (!name.startsWith("_")) {
Logger.info("Module %s is available (%s)", name, path.getAbsolutePath());
}
}
示例2: addNews
import play.vfs.VirtualFile; //导入方法依赖的package包/类
public void addNews(@Required String path, @Required String title, @Required Date date, String tags) {
checkAuthenticity();
if (validation.hasErrors()) forbidden(validation.errorsMap().toString());
WebPage.News parent = WebPage.forPath(path);
if (parent.isStory()) parent = (WebPage.News) parent.parent();
if (parent.isMonth()) parent = (WebPage.News) parent.parent();
if (parent.isYear()) parent = (WebPage.News) parent.parent();
String pathSuffix = new SimpleDateFormat("yyyy/MM/dd").format(date);
File dir = new File(parent.dir.getRealFile(), pathSuffix);
while (dir.exists()) dir = new File(dir.getPath() + "-1");
dir.mkdirs();
VirtualFile vdir = VirtualFile.open(dir);
vdir.child("metadata.properties").write("title: " + title + "\ntags: " + defaultString(tags) + "\n");
vdir.child("content.html").write(Messages.get("web.admin.defaultContent"));
WebPage.News page = WebPage.forPath(vdir);
redirect(page.path);
}
示例3: onLoad
import play.vfs.VirtualFile; //导入方法依赖的package包/类
@Override
public void onLoad() {
VirtualFile appRoot = VirtualFile.open(Play.applicationPath);
Play.javaPath.add(appRoot.child("test"));
for (VirtualFile module : Play.modules.values()) {
File modulePath = module.getRealFile();
if (!modulePath.getAbsolutePath().startsWith(Play.frameworkPath.getAbsolutePath()) && !Play.javaPath.contains(module.child("test"))) {
Play.javaPath.add(module.child("test"));
}
}
}
示例4: resolveLinkedPages
import play.vfs.VirtualFile; //导入方法依赖的package包/类
private static VirtualFile resolveLinkedPages(VirtualFile file) {
File parent = file.getRealFile();
while (!parent.exists()) parent = parent.getParentFile();
WebPage existingParent = forPath(VirtualFile.open(parent));
String contentFrom = existingParent.metadata.getProperty("contentFrom");
if (isEmpty(contentFrom)) return file;
WebPage contentParent = forPath(contentFrom);
return VirtualFile.open(new File(contentParent.dir.getRealFile(), file.getRealFile().getPath().replace(parent.getPath(), "")));
}
示例5: WebPage
import play.vfs.VirtualFile; //导入方法依赖的package包/类
/** ROOT */
WebPage() {
dir = VirtualFile.open(canonicalPath(Play.getFile(Play.configuration.getProperty("web.content", "web-content"))));
path = "/";
metadata = new Properties();
}