| 264 | } |
| 265 | |
| 266 | async function findReadingProgressPaths(path, all = false) |
| 267 | { |
| 268 | if(!all) |
| 269 | { |
| 270 | const regex = new RegExp('^\s*'+pregQuote(path)+'(?:[\\\/\\\\]|$)'); |
| 271 | const readingProgress = relative.get('readingProgress'); |
| 272 | |
| 273 | let paths = Object.keys(readingProgress).filter(function(key){ |
| 274 | |
| 275 | return regex.test(key); |
| 276 | |
| 277 | }); |
| 278 | |
| 279 | if(paths.length > 1) |
| 280 | { |
| 281 | // Remove parent key |
| 282 | paths = paths.filter(function(key){ |
| 283 | |
| 284 | return path !== key; |
| 285 | |
| 286 | }); |
| 287 | } |
| 288 | |
| 289 | return paths; |
| 290 | } |
| 291 | else |
| 292 | { |
| 293 | const file = fileManager.file(path); |
| 294 | file.updateConfig({sort: false}); |
| 295 | const paths = await _findReadingProgressPaths(path, file); |
| 296 | file.destroy(); |
| 297 | |
| 298 | return paths; |
| 299 | } |
| 300 | } |
| 301 | |
| 302 | async function read(path) |
| 303 | { |