FilePersistence.java 文件源码

java
阅读 19 收藏 0 点赞 0 评论 0

项目:red5-server 作者:
/**
 * Initializes the root directory and creates it if it doesn't already exist.
 * 
 * @param rootFile
 * @param contextPath
 * @throws IOException
 */
private void initRootDir(Resource rootFile, String contextPath) throws IOException {
    if (rootFile instanceof ServletContextResource) {
        rootDir = String.format("%s/webapps%s", System.getProperty("red5.root"), contextPath);
    } else if (resources instanceof IScope) {
        rootDir = String.format("%s%s", resources.getResource("/").getFile().getAbsolutePath(), contextPath);
    }
    log.debug("Persistence directory path: {}", rootDir);
    File persistDir = new File(rootDir, path);
    if (!persistDir.exists()) {
        if (!persistDir.mkdirs()) {
            log.warn("Persistence directory creation failed");
        } else {
            log.debug("Persistence directory access - read: {} write: {}", persistDir.canRead(), persistDir.canWrite());
        }
    } else {
        log.debug("Persistence directory access - read: {} write: {}", persistDir.canRead(), persistDir.canWrite());
    }
    persistDir = null;
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号