readium / SDKLauncher-Android

Launcher app for Readium SDK on Android
BSD 3-Clause "New" or "Revised" License
77 stars 65 forks source link

WriterAtPath not working #138

Closed rahulk11 closed 6 years ago

rahulk11 commented 6 years ago

I need to create a text file inside epub zip before opening it. But i am not able to get writer using WriterAtPath method, it throws

mkstemp failed: invalid argument

this is what i tried

#if ENABLE_ZIP_ARCHIVE_WRITER
    unique_ptr<ArchiveWriter> w = _archive->WriterAtPath(filePath); 
#endif //ENABLE_ZIP_ARCHIVE_WRITER

please guide me, what am i doing wrong here?

danielweck commented 6 years ago

To my knowledge, nobody tested the "write" API of ReadiumSDK except maybe the original developer), I am not sure it ever really worked.

rahulk11 commented 6 years ago

@danielweck so, what do you suggest i should try? Because the file contains some key information which the epub will not work without.

Thanks.

rahulk11 commented 6 years ago

@danielweck I see that readium sdk is using an old version of libzip which contains many deprecated methods, including zip_add and zip_replace. May be the error is because of this?

danielweck commented 6 years ago

I would personally use ReadiumSDK as a read-only lib to consume a ready-made EPUB (not to modify publication packages). I would write platform-specific code (e.g. Android Java or Kotlin) to alter existing EPUBs, if this was indeed needed.

By the way, why do you need to change EPUB contents?

rahulk11 commented 6 years ago

@danielweck thanks for your suggestion. i will think on it.

The epubs that i have are not standard epubs and contains manifest/spine info in a .json file instead of a .xml file. I am trying to generate and write a respective xml file based on json data. So that it can be read by readium.

danielweck commented 6 years ago

I am afraid consuming non-EPUB files is out of scope for ReadiumSDK. I am closing this issue now, feel free to re-open or continue to discuss if you have updates to share. Thanks!