{"action":"created","issue":{"url":"https://api.github.com/repos/gali8/Tesseract-OCR-iOS/issues/158","labels_url":"https://api.github.com/repos/gali8/Tesseract-OCR-iOS/issues/158/labels{/name}","comments_url":"https://api.github.com/repos/gali8/Tesseract-OCR-iOS/issues/158/comments","events_url":"https://api.github.com/repos/gali8/Tesseract-OCR-iOS/issues/158/events","html_url":"https://github.com/gali8/Tesseract-OCR-iOS/pull/158","id":65217706,"number":158,"title":"Add the possibility to load language files from any directory","user":{"login":"PatrickNLT","id":2445263,"avatar_url":"https://avatars.githubusercontent.com/u/2445263?v=3","gravatar_id":"","url":"https://api.github.com/users/PatrickNLT","html_url":"https://github.com/PatrickNLT","followers_url":"https://api.github.com/users/PatrickNLT/followers","following_url":"https://api.github.com/users/PatrickNLT/following{/other_user}","gists_url":"https://api.github.com/users/PatrickNLT/gists{/gist_id}","starred_url":"https://api.github.com/users/PatrickNLT/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/PatrickNLT/subscriptions","organizations_url":"https://api.github.com/users/PatrickNLT/orgs","repos_url":"https://api.github.com/users/PatrickNLT/repos","events_url":"https://api.github.com/users/PatrickNLT/events{/privacy}","received_events_url":"https://api.github.com/users/PatrickNLT/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":12,"created_at":"2015-03-30T13:55:35Z","updated_at":"2015-04-19T18:50:27Z","closed_at":"2015-04-02T09:41:36Z","pull_request":{"url":"https://api.github.com/repos/gali8/Tesseract-OCR-iOS/pulls/158","html_url":"https://github.com/gali8/Tesseract-OCR-iOS/pull/158","diff_url":"https://github.com/gali8/Tesseract-OCR-iOS/pull/158.diff","patch_url":"https://github.com/gali8/Tesseract-OCR-iOS/pull/158.patch"},"body":"Having language files stored into the cache directory is rather restrictive as the system may clean this directory from time to time.\r\nMy initializer allows the developer to store the language files somewhere else (typically in the Application Support directory)."},"comment":{"url":"https://api.github.com/repos/gali8/Tesseract-OCR-iOS/issues/comments/94304863","html_url":"https://github.com/gali8/Tesseract-OCR-iOS/pull/158#issuecomment-94304863","issue_url":"https://api.github.com/repos/gali8/Tesseract-OCR-iOS/issues/158","id":94304863,"user":{"login":"ws233","id":462439,"avatar_url":"https://avatars.githubusercontent.com/u/462439?v=3","gravatar_id":"","url":"https://api.github.com/users/ws233","html_url":"https://github.com/ws233","followers_url":"https://api.github.com/users/ws233/followers","following_url":"https://api.github.com/users/ws233/following{/other_user}","gists_url":"https://api.github.com/users/ws233/gists{/gist_id}","starred_url":"https://api.github.com/users/ws233/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ws233/subscriptions","organizations_url":"https://api.github.com/users/ws233/orgs","repos_url":"https://api.github.com/users/ws233/repos","events_url":"https://api.github.com/users/ws233/events{/privacy}","received_events_url":"https://api.github.com/users/ws233/received_events","type":"User","site_admin":false},"created_at":"2015-04-19T18:50:27Z","updated_at":"2015-04-19T18:50:27Z","body":"@PatrickNLT, thanks you a lot for the feature.\r\nI have a few questions and comments about the feature branch.\r\n* Is it really necessary to copy tessdata somewhere else besides 'Caches' folder? Even if the OS removes that folder, it will be recreated again, and again, and again without any flags specified. Isn't it? Even if, why do we forbid the system to remove that data, if it really needs a space?\r\n* 'Caches' folder is an appropriate place for such data, cause they can easily be recreated as I mentioned above. They could be released, if the user needs a space for any other data. They are also never changed. And furthermore they never should be backed up! But they will by default, if they are copied to 'AppSupport' folder. As it's written here: https://developer.apple.com/library/ios/documentation/FileManagement/Conceptual/FileSystemProgrammingGuide/FileSystemOverview/FileSystemOverview.html#//apple_ref/doc/uid/TP40010672-CH2-SW28\r\nEven if we decide to leave an opportunity to copy data to 'AppSupport', should we allow user to copy tessdata to EVERYWHERE? Perhaps, it's better to rewrite the initializer the same way as cachesDataPath initializer, so it only copies tessdata into relative 'AppSupport' subfolder? It's more safe.\r\n* Why the copyFilesFromResources parameter is here? It seems redundant. As I already mentioned above this behavior is supposed by default with the code, we have before. Anyway, if it's here, why don't you write tests for the following cases:\r\na. nil absoluteDataPath is specified together with copyFilesFromResources = YES parameter\r\nb. not nil absoluteDataPath is specified together with copyFilesFromResources = YES parameter, while absoluteDataPath folder already has testate files in place?\r\n* Even if the following tests are going to be implemented, what is an expected behavior for case b from the above? Should the tessdata be rewritten? Even if it seems rationally, why? Furthermore, the current code creates symbolic links only if there is no destination file. We did this specially not to rewrite newer versions of language files if they have been download from the Internet by the user. So the code should be changed to allow this behavior.\r\n* With such flag available we also add another ambiguous case: nil absoluteDataPath with copyFilesFromResources = YES. What does this mean? Will the files be copied? Where?\r\n* With this flag we do already have some cases, which return nil tesseract. That's from your test:\r\n\r\n        tesseract = [[G8Tesseract alloc] initWithLanguage:kG8Languages configDictionary:nil configFileNames:nil absoluteDataPath:customDirectoryPath engineMode:G8OCREngineModeTesseractOnly copyFilesFromResources:NO];\r\n        [[tesseract should] beNil];\r\n\r\nWhy do you think returning a nil in a such case is a good idea? nil data path means tesseract cannot continue to work from the app bundle? We tried to write code in a such way, that tesseract could work with any input parameters. As I already mentioned above, your copyFilesFromResources adds an ambiguity and wrong expectations. If I specify a nil cachesDataPath, tesseract starts and works. If I use your initializer and specifies nil absoluteDataPath, I don't receive tesseract instance at all. So, as I think a new initializer should be rewritten to support a hole concept of this repo. It should do as much work for user as possible and return nil only if there is really nothing to deal with input parameters.\r\n* I also have some more complains about test implementation, but let's leave it for now."}}