/*
 * This file is part of libbluray
 * Copyright (C) 2010  William Hahne
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library. If not, see
 * <http://www.gnu.org/licenses/>.
 */

package org.videolan;

import java.text.DecimalFormat;

public class BDJUtil {
    /**
     * Make a five digit zero padded string based on an integer
     * Ex. integer 1 -> string "00001"
     * 
     * @param id
     * @return
     */
    public static String makeFiveDigitStr(int id) 
    {
        DecimalFormat fmt = new DecimalFormat();
        fmt.setMaximumIntegerDigits(5);
        fmt.setMinimumIntegerDigits(5);
        fmt.setGroupingUsed(false);
        
        return fmt.format(id);
    }
    
    /**
     * Make a path based on the disc root to an absolute path based on the filesystem of the computer
     * Ex. /BDMV/JAR/00000.jar -> /bluray/disc/mount/point/BDMV/JAR/00000.jar
     * @param path
     * @return
     */
    public static String discRootToFilesystem(String path)
    {
        return System.getProperty("bluray.vfs.root") + path;
    }
}

@@ -1560,22 +1560,32 @@
         
-return
+String vfsRoot =
  System.
@@ -1614,16 +1614,185 @@
 s.root%22)
+;%0A        if (vfsRoot == null) %7B%0A            System.err.println(%22discRootToFilesystem(): disc root not set !%22);%0A            return path;%0A        %7D%0A        return vfsRoot
  + path;

check for null