Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -80,12 +80,13 @@ protected void doAttach() throws IOException {
}
}
com.google.api.services.drive.Drive.Files.List request = null;
// TODO: figure out which fields are needed and add only those instead of using `*` below
if (path.equals("/")) {
/* Root */
request = drive.files().list().setQ("'root' in parents");
request = drive.files().list().setFields("*").setQ("'root' in parents");
} else if (file != null && "application/vnd.google-apps.folder".equals(file.getMimeType())) {
/* If this is known to be a directory, list the files in it */
request = drive.files().list().setQ(String.format("'%s' in parents", file.getId()));
request = drive.files().list().setFields("*").setQ(String.format("'%s' in parents", file.getId()));
}
if (request != null) {
children = new ArrayList<File>();
Expand Down Expand Up @@ -207,6 +208,17 @@ private long processTime(DateTime dateTime) {
return dateTime == null ? 0 : dateTime.getValue();
}

@Override
protected void onChange() throws IOException {
this.refresh();
try {
// TODO: not sure why this sleep is needed but without it creating a file by writing to it and
// then immediately trying to read it fails
Thread.sleep(1000);
} catch (InterruptedException exception) {
}
}

@Override
protected long doGetContentSize() throws Exception {
return file == null ? 0 : (file.getSize() == null ? 0 : file.getSize().longValue());
Expand Down