{"id":13777698,"url":"https://github.com/TomasMikula/LiveDirsFX","last_synced_at":"2025-05-11T11:33:59.763Z","repository":{"id":15752154,"uuid":"18490869","full_name":"TomasMikula/LiveDirsFX","owner":"TomasMikula","description":"Directory tree model for JavaFX that watches the filesystem for changes.","archived":false,"fork":false,"pushed_at":"2020-09-21T22:47:59.000Z","size":94,"stargazers_count":47,"open_issues_count":6,"forks_count":9,"subscribers_count":10,"default_branch":"master","last_synced_at":"2024-05-02T05:24:20.796Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-2-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/TomasMikula.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-04-06T14:06:13.000Z","updated_at":"2023-04-08T03:09:52.000Z","dependencies_parsed_at":"2022-09-24T18:13:33.460Z","dependency_job_id":null,"html_url":"https://github.com/TomasMikula/LiveDirsFX","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TomasMikula%2FLiveDirsFX","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TomasMikula%2FLiveDirsFX/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TomasMikula%2FLiveDirsFX/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TomasMikula%2FLiveDirsFX/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/TomasMikula","download_url":"https://codeload.github.com/TomasMikula/LiveDirsFX/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253559218,"owners_count":21927549,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-03T18:00:47.427Z","updated_at":"2025-05-11T11:33:59.398Z","avatar_url":"https://github.com/TomasMikula.png","language":"Java","funding_links":[],"categories":["Libraries, Tools and Projects","GUI开发/程序"],"sub_categories":["文件同步"],"readme":"LiveDirsFX\n==========\n\nLiveDirsFX is a combination of a directory watcher, a directory-tree model (for [TreeView](http://docs.oracle.com/javase/8/javafx/api/javafx/scene/control/TreeView.html)) and a simple asynchronous file I/O facility. The extra benefits of this combination are:\n 1. Automatic synchronization of the directory model with the filesystem.\n 2. Ability to distinguish directory and file modifications made by the application (through the I/O facility) from external modifications.\n\n\nExample\n-------\n\n```java\nenum ChangeSource {\n    INTERNAL, // indicates a change made by this application\n    EXTERNAL, // indicates an external change\n}\n\n// create LiveDirs to watch a directory\nLiveDirs\u003cChangeSource\u003e liveDirs = new LiveDirs\u003c\u003e(EXTERNAL);\nPath dir = Paths.get(\"/path/to/watched/directory/\");\nliveDirs.addTopLevelDirectory(dir);\n\n// use LiveDirs as a TreeView model\nTreeView\u003cPath\u003e treeView = new TreeView\u003c\u003e(liveDirs.model().getRoot());\ntreeView.setShowRoot(false);\n\n// handle external changes\nliveDirs.model().modifications().subscribe(m -\u003e {\n    if(m.getInitiator() == EXTERNAL) {\n        // handle external modification, e.g. reload the modified file\n        reload(m.getPath());\n    } else {\n        // modification done by this application, no extra action needed\n    }\n});\n\n// Use LiveDirs's I/O facility to write to the filesystem,\n// in order to be able to distinguish between internal and external changes.\nPath file = dir.resolve(\"some/file.txt\");\nliveDirs.io().saveUTF8File(file, \"Hello text file!\", INTERNAL);\n\n// clean up\nliveDirs.dispose();\n```\n\n\nUse LiveDirsFX in your project\n------------------------------\n\n### Method 1: as a managed dependency (recommended)\n\nSnapshot releases are deployed to Sonatype snapshot repository with these Maven coordinates\n\n| Group ID            | Artifact ID | Version        |\n| :-----------------: | :---------: | :------------: |\n| org.fxmisc.livedirs | livedirsfx  | 1.0.0-SNAPSHOT |\n\n#### Gradle example\n\n```groovy\nrepositories {\n    maven {\n        url 'https://oss.sonatype.org/content/repositories/snapshots/' \n    }\n}\n\ndependencies {\n    compile group: 'org.fxmisc.livedirs', name: 'livedirsfx', version: '1.0.0-SNAPSHOT'\n}\n```\n\n#### Sbt example\n\n```scala\nresolvers += \"Sonatype OSS Snapshots\" at \"https://oss.sonatype.org/content/repositories/snapshots\"\n\nlibraryDependencies += \"org.fxmisc.livedirs\" % \"livedirsfx\" % \"1.0.0-SNAPSHOT\"\n```\n\n\n### Method 2: as an unmanaged dependency\n\nDownload the latest [JAR](https://oss.sonatype.org/content/repositories/snapshots/org/fxmisc/livedirs/livedirsfx/1.0.0-SNAPSHOT/) or [fat JAR (including dependencies)](https://googledrive.com/host/0B4a5AnNnZhkbMzRneXVNUEI3anc/downloads/) and place it on your classpath.\n\n\nLinks\n-----\n\n[Javadoc](http://www.fxmisc.org/livedirs/javadoc/org/fxmisc/livedirs/package-summary.html)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FTomasMikula%2FLiveDirsFX","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FTomasMikula%2FLiveDirsFX","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FTomasMikula%2FLiveDirsFX/lists"}