Giter Site home page Giter Site logo

fat32-lib's People

Contributors

janseeger avatar waldheinz avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

fat32-lib's Issues

size calculation for cluster-offset might be short by one byte

(from Google Code)

Reported by marc.greim, Aug 11, 2013

on line 211 in ClusterChain.java (5e34cb7eb178) the partial read calculates the size to read as:

200 int size = Math.min(len,
211 (int) (clusterSize - (offset % clusterSize) - 1));

The subtraction of 1 at the end of the line seems wrong to me. In my tests removing the -1 solves issues while playing mp3/video after a seek.

Image File Does Not Work When Deploying to Pi Zero

I used the ImageBuilder class to build a simple 4 file Raspberry Pi boot image (containing a custom serial boot loader...not a linux OS). I use dd to transfer the image to an SD card. When I mount the card on my Mac, I see the files, and when I md5 all the files on the card, they match with the source directory. However, when I try to boot the Pi, it will not boot. However, if I re-mount the card on my Mac, and then copy the original files over the files deployed with the image (via the Finder), the Pi will then boot.

I would have thought that not having a partition table (via the super floppy format) might be a problem with the Pi, but simply copying files should not alter the partition table.

I see this really nice lib has not been updated in a while, but I would appreciate some guidance on what I might try to diagnose.

Navigation up the directory structure is impossible

Reported by ricardospadilha, Nov 8, 2010
Hi,

it seems that navigation up the directory structure is impossible, i.e., starting from a 2 or 3 levels deep directory it is impossible to navigate up to the grand-parent directory.

From any given FsDirectoryEntry we can access the parent FsDirectory through getParent(). However, from FsDirectory there is no way to access that directory's FsDirectoryEntry in order to find that directory's parent.

I think that in general both FsFile and FsDirectory should have methods to retrieve the underlying FsDirectory that supports them.

Bug in FatDirectoryEntry.parseLfn: Fat can get corrupted

Fat can get corrupted when you read an existing image and add an new entry to a directory with
a longname that will result in a shortname that is equal to an existing entry. For example if the root directory of an existing image contains a file named bundle.jar (with shortname bundle~1.jar) and you wil add another entry to the root directory say a directory named bundle.jar-embedded. This new entry also gets the shortname bundle~1.jar instead of bundle~2.jar. This happens because usedNames is missing bundle~1.jar as entry.

documentation

Hi,
I was trying for a while to find out how to use the library properly. Could you give a short information for e.g. loading an existing image, navigating throw some folders, create a file ?
I am having trouble to find the "user interface" classes.

Kind regards

Add JDK7 FileSystem Support

From Ernest at

http://waldheinz.de/2010/04/release-candidate-for-fat32-lib/

Have you put any thought to perhaps implementing a JDK7/NIO2 compliant FileSystemProvider (see http://download.oracle.com/javase/7/docs/technotes/guides/io/fsp/filesystemprovider.html) in order to make this available as a first-class supporter of the Path API introduced in NIO2?

There is a ZIP fs implementation included with JDK7, also some theoretical discussion about a ramdisk support of sorts, but no-one has done it, as far as I know. This seems to be the closest thing to it…

Change License to Apache v2 or BSD

I would like to use the fat32-lib in a commercial product. I do not need to modify the code. I would however like to distribute it as part of an überjar, which unfortunately makes it very difficult for the users to swap out the library for newer versions themselves (an LGPL requirement).

Would it be acceptable to you to relicense the code under a more permissive license (Apache 2 or BSD)?

Any changes I would have to make to the library would of course be contributed back.

Thanks,
Axel

Directories

If you use fsroot.addDirectory returns a DirectoryEntry when it should return another FsDirectory. Because if you only get a FsDirectoryEntry, you can not use Long file names that are already implemented to navigate throgh the directory tree. The only workaround is to directly use the FATspecific classes which I think were meant to be used via the generic File System Interface.

Additionally the call to addDirectory should also create the . and .. Directory entries so that the image used by another driver can actually navigate into that directory. I get an error doing that.

    File file = new File("C:\\fat32test.img");
    FileDisk filedisk = new FileDisk(file, false);

    FileSystem fs = FileSystemFactory.create(filedisk, false);
    FsDirectory fsroot = fs.getRoot();
    fsroot.
    FsDirectoryEntry subdir = fsroot.addDirectory("adddir");

Properly deal with the unknown timezone

All times/dates on FAT file systems are stored in "local time". But it is nowhere recorded which is that local time zone, so it should be possible to specify it.

Or just do what Linux does.

Writing to SD Card image

Hi,

This library is great, but I am having an issue with writing to an SD card image.

I create it with the android tool 'mksdcard', then load it as a Fat32 File System using this API.
I proceed to mount the image, and the output looks like:
However, after writing each file to the card, trying to navigate the output looks like:

Joe-Laptop:/mnt/sd # ls -l
ls: cannot access docs: Input/output error
ls: cannot access projects: Input/output error
ls: cannot access codes: Input/output error
total 0
d????????? ? ? ? ? ? docs
d????????? ? ? ? ? ? codes
d????????? ? ? ? ? ? projects

Is there any way to ensure that the directories and file write correctly?

Entry unique name not freed when entry is moved

Great library - thanks for creating and maintaining it. I used this a couple of months ago and ran into what I think is a bug. The test case is below but basically if you move a file then it's unique name is not freed from its original parent directory, so you can't add a new file of the same name or move the old file back.

I fixed this in FatLfnDirectory.java by moving the call to "freeUniqueName()" from the remove() method (line 380) to the bottom of the the unlinkEntry() (now line 412).

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.fail;

import java.io.IOException;

import org.junit.Before;
import org.junit.Test;

import de.waldheinz.fs.fat.FatFileSystem;
import de.waldheinz.fs.fat.FatLfnDirectory;
import de.waldheinz.fs.fat.FatLfnDirectoryEntry;
import de.waldheinz.fs.fat.SuperFloppyFormatter;
import de.waldheinz.fs.util.RamDisk;


public class MoveToReplaceTest {

    private static final String FILE_NAME = "file"; 
    private static final String DIRECTORY_NAME = "dir"; 

    private FatLfnDirectoryEntry file;
    private FatLfnDirectoryEntry dir;
    private FatLfnDirectory root;
    private FatFileSystem fs;


    @Before
    public void setUp() throws IOException {
        RamDisk dev = new RamDisk(1024 * 1024);
        fs = SuperFloppyFormatter.get(dev).format();

        root = fs.getRoot();
        file = root.addFile(FILE_NAME);
        dir = root.addDirectory(DIRECTORY_NAME);

    }

    @Test
    public void moveToAndReplaceTest() throws IOException {
        // Move file form root to dir
        file.moveTo(dir.getDirectory(), DIRECTORY_NAME);

        // Check that the file has been moved and isn't in the original dir
        assertEquals(file.getParent(), dir.getDirectory());
        assertNull( root.getEntry(FILE_NAME) );

        // Create a new file with a SAME filename in the original dir
        try {
            root.addFile(FILE_NAME);
        } catch (IOException e) {
            // Code will fail here
            //  java.io.IOException: an entry named file already exists
            //  at de.waldheinz.fs.fat.FatLfnDirectory.checkUniqueName(FatLfnDirectory.java:162)
            //  at de.waldheinz.fs.fat.FatLfnDirectory.addFile(FatLfnDirectory.java:135)
            e.printStackTrace();
            fail("IO Exception");
        }
    }

}

Investigate Volume Label Charset

With the current implementation, the volume label can only contain characters which are

  • ASCII and
  • pass through ShortName.checkValidChars(..).

A recent Windows XP and Windows 7 allow more then that, but which charset is used remains unclear for now. Linux / KDE does not properly deal with these volume labels currently.

Long file names

fsroot.addFile can not add a file with a long file name. I think it should be.

    File file = new File("C:\\fat32test.img");
    FileDisk filedisk = new FileDisk(file, false);
    FileSystem fs = FileSystemFactory.create(filedisk, false);
    FsDirectory fsroot = fs.getRoot();
    fsroot.addFile("LOOOOOOONGFileName.txt");

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.