-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
20 changed files
with
117 additions
and
119 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
Before running Canvas Sync for the first time, open a terminal window | ||
and run | ||
|
||
``` | ||
xattr -c 'Canvas Sync.app' | ||
``` | ||
|
||
first. Otherwise there will be an error saying that this app is | ||
developed by an unidentified developer, but that's just me, the dev. | ||
|
||
If you've dragged-and-dropped Canvas Sync into the /Applications | ||
folder already, simply run | ||
|
||
``` | ||
xattr -c '/Applications/Canvas Sync.app' | ||
``` | ||
|
||
instead. Enjoy! |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,95 +1,62 @@ | ||
#include "filetree.h" | ||
#include <algorithm> | ||
#include <string> | ||
|
||
void debug(FileTree *t, int level) | ||
{ | ||
std::string indent = std::string(2 * (level + 1), ' '); | ||
std::cout << indent << t->id << ", " << t->name << std::endl; | ||
for (FileTree nested : t->folders) { | ||
debug(&nested, level + 1); | ||
} | ||
for (auto file : t->files) { | ||
std::cout << indent << file.filename << std::endl; | ||
} | ||
// if (t->files.empty()) { | ||
// cout << indent << "[no files]" << endl; | ||
// } | ||
} | ||
void debug(FileTree *t) | ||
{ | ||
std::cerr << "FileTree" << std::endl; | ||
debug(t, 0); | ||
} | ||
|
||
void FileTree::to_string(std::string *state) | ||
{ | ||
*state += "{(" + std::to_string(this->id) + ',' + this->name + "):"; | ||
for (FileTree nested : this->folders) { | ||
nested.to_string(state); | ||
} | ||
*state += '}'; | ||
} | ||
|
||
std::string FileTree::to_string() | ||
{ | ||
std::string state = ""; | ||
this->to_string(&state); | ||
return state; | ||
} | ||
|
||
bool compareFolderPath(Folder f1, Folder f2) | ||
{ | ||
return f1.full_name < f2.full_name; | ||
} | ||
|
||
bool compareTreeName(FileTree f1, FileTree f2) | ||
{ | ||
return f1.name < f2.name; | ||
} | ||
|
||
void FileTree::insert_folder(Folder *f) | ||
{ | ||
this->insert_tree(new FileTree(f), f->full_name); | ||
} | ||
|
||
void FileTree::insert_folders(std::vector<Folder> folders) | ||
{ | ||
sort(folders.begin(), folders.end(), compareFolderPath); | ||
for (Folder f : folders) | ||
this->insert_folder(&f); | ||
} | ||
|
||
void FileTree::insert_tree(FileTree *t, std::string state) | ||
void FileTree::insert_folder(Folder &f, std::string &state) | ||
{ | ||
size_t slash_idx = state.find('/'); | ||
|
||
// no more folders to traverse. insert here. | ||
if (slash_idx == std::string::npos) { | ||
this->folders.push_back(*t); | ||
this->folders.push_back(*new FileTree(f)); | ||
return; | ||
} | ||
|
||
// find the next folder to go recurse into. | ||
std::string query = state.substr(0, slash_idx); | ||
size_t size = this->folders.size(); | ||
for (size_t i = 0; i < size; i++) { | ||
for (size_t i = 0; i < this->folders.size(); i++) { | ||
if (this->folders[i].name != query) | ||
continue; | ||
this->folders[i].insert_tree(t, state.substr(slash_idx + 1)); | ||
std::string next_state = state.substr(slash_idx + 1); | ||
this->folders[i].insert_folder(f, next_state); | ||
break; | ||
} | ||
} | ||
|
||
void FileTree::insert_tree(FileTree *t) | ||
void FileTree::insert_folder(Folder &f) | ||
{ | ||
this->insert_tree(t, t->name); | ||
insert_folder(f, f.full_name); | ||
}; | ||
|
||
void FileTree::insert_course_tree(FileTree &t) | ||
{ | ||
this->folders.push_back(std::move(t)); | ||
} | ||
|
||
void FileTree::insert_trees(std::vector<FileTree> trees) | ||
void FileTree::to_string(std::string &state) | ||
{ | ||
sort(trees.begin(), trees.end(), compareTreeName); | ||
for (FileTree t : trees) { | ||
this->insert_tree(&t); | ||
} | ||
state += "{(" + std::to_string(this->id) + ',' + this->name + "):"; | ||
for (FileTree t : this->folders) | ||
t.to_string(state); | ||
state += '}'; | ||
} | ||
|
||
std::string FileTree::to_string() | ||
{ | ||
std::string state = ""; | ||
this->to_string(state); | ||
return state; | ||
} | ||
|
||
void debug(const FileTree &t, int level) | ||
{ | ||
std::string indent = std::string(2 * (level + 1), ' '); | ||
std::cout << indent << t.id << ", " << t.name << std::endl; | ||
for (FileTree nested : t.folders) | ||
debug(nested, level + 1); | ||
for (auto file : t.files) | ||
std::cout << indent << file.filename << std::endl; | ||
} | ||
void debug(const FileTree &t) | ||
{ | ||
std::cerr << "FileTree" << std::endl; | ||
debug(t, 0); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters