Permalink
Browse files

Hacky windows support

  • Loading branch information...
1 parent 20f2166 commit 0c5866d93c3e14dcab2249d8a8b51df64ff827e3 unknown committed Sep 24, 2012
View
0 config.guess 100755 → 100644
No changes.
View
0 config.sub 100755 → 100644
No changes.
View
0 configure 100755 → 100644
No changes.
View
0 depcomp 100755 → 100644
No changes.
View
0 install-sh 100755 → 100644
No changes.
View
@@ -2,7 +2,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>com.jsync</groupId>
<artifactId>JSync</artifactId>
- <version>${version}</version>
+ <version>0.0.1</version>
<dependencies>
<dependency>
@@ -0,0 +1,8 @@
+package com.jsync;
+
+/**
+ * User: sanders
+ * Date: 9/23/12
+ */
+public class FsResourceUnix {
+}
@@ -0,0 +1,108 @@
+package com.jsync;
+
+import java.io.File;
+import java.util.ArrayList;
+
+/**
+ * User: sanders
+ * Date: 9/23/12
+ */
+public class FsResourceWindows extends FsResource {
+
+ public FsResourceWindows(File file) {
+ super(file);
+ }
+ public FsResourceWindows(String fn) {
+ super(new File(fn));
+ }
+
+ @Override
+ public IResource[] list() {
+ if (file.isDirectory()) {
+ String[] files = file.list();
+ if (files == null) {
+ return new FsResourceWindows[0];
+ } else {
+ ArrayList<FsResourceWindows> resultList;
+ resultList = new ArrayList<FsResourceWindows>();
+ for (String child: files) {
+ File resource = new File(file, child);
+ resultList.add(new FsResourceWindows(resource));
+ }
+ FsResourceWindows[] out = new FsResourceWindows[resultList.size()];
+ return resultList.toArray(out);
+ }
+ } else if (file.isFile()) {
+ return new FsResourceWindows[0];
+ }
+ return null;
+ }
+
+ @Override
+ public FsResource join(String name) {
+ return new FsResourceWindows(new File(file, name));
+ }
+
+ @Override
+ public boolean isSymlink() {
+ return false;
+ }
+
+ @Override
+ public int getMode() {
+ return 0;
+ }
+
+ @Override
+ public void setGid(int gid) {
+ }
+
+ @Override
+ public int getGid() {
+ return 0;
+ }
+
+ @Override
+ public void setUid(int uid) {
+ }
+
+ @Override
+ public int getUid() {
+ return 0;
+ }
+
+ @Override
+ public void setMode(int mode) {
+
+ }
+
+ @Override
+ public void createSymlink(String target) {
+
+ }
+
+ @Override
+ public long getAccessTime() {
+ return 0;
+ }
+
+ @Override
+ public void setAccessTime(long accessTime) {
+
+ }
+
+ @Override
+ public long getModifiedTime() {
+ return 0;
+ }
+
+ @Override
+ public void setModifiedTime(long modifiedTime) {
+
+ }
+
+ @Override
+ public String getSymlinkTarget() {
+ return null;
+ }
+}
@@ -3,10 +3,7 @@
import java.io.IOException;
public class JSync {
- static {
- System.setProperty("jna.library.path", System.getenv("LIBJSYNC_PATH"));
- }
public static void main(String[] args) throws IOException {
JSyncOptions options = new JSyncOptions(args);
@@ -40,8 +40,13 @@ public IResource generateResource(String path) {
try {
uri = new URI(path);
} catch (URISyntaxException e) {
- System.out.println("Cannot parse URI");
- return new FsResource(path);
+ System.out.println(System.getProperty("os.name"));
+ if (System.getProperty("os.name").equals("Windows 7")) {
+ System.out.println("Using windows style files");
+ return new FsResourceWindows(path);
+ } else {
+ return new FsResource(path);
+ }
}
String scheme = uri.getScheme();
if (scheme == null || scheme.equals("file")) {
View
0 missing 100755 → 100644
No changes.

0 comments on commit 0c5866d

Please sign in to comment.