Skip to content

Commit

Permalink
path debug messages3
Browse files Browse the repository at this point in the history
  • Loading branch information
Fry authored and Fry committed Mar 12, 2017
1 parent 3ba7157 commit e857e74
Show file tree
Hide file tree
Showing 6 changed files with 170 additions and 147 deletions.
294 changes: 154 additions & 140 deletions .idea/workspace.xml

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "electron-dde",
"productName": "DDE",
"version": "1.0.2",
"version": "1.0.3",
"release_date": "Mar 12, 2017",
"description": "Dexter Development Environment",
"author": "Fry",
Expand Down
4 changes: 3 additions & 1 deletion ready.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,9 @@
}

function init_guide(){
doc_pane_content_id.innerHTML = file_content(__dirname + "/doc/guide.html")
const path = __dirname + "/doc/guide.html"
console.log("init_guide using path: " + path)
doc_pane_content_id.innerHTML = file_content(path)
}

function init_ref_man(){
Expand Down
4 changes: 3 additions & 1 deletion ros_interface.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@ function init_ros_service(url) { //url must start with ws:// and end with /, but
}
else {
try {
ros = new ROSLIB.Ros({
ros = new ROSLIB.Ros({ //normally this causes an error printing in the console of:
//"websocket connection to {url} failed" BUT the catch clause below doesn't catch it,
//so I can't supress that error message in the console.
url : url //'ws://localhost:9090'
})
}
Expand Down
Binary file removed screenshot.png
Binary file not shown.
13 changes: 9 additions & 4 deletions storage.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,14 +58,15 @@ function persistent_remove(key, callback=function() { out("Removed " + key + " f

//FILE SYSTEM
function add_default_file_prefix_maybe(path){
if (path.startsWith("/")) { return path }
if (is_root_path(path)) { return path }
else return dde_apps_dir + "/" + path
}

function file_content(path, encoding="utf8"){
path = add_default_file_prefix_maybe(path)
path = adjust_path_to_os(path)
return fs.readFileSync(path, encoding);
console.log("file_content ultimately using path: " + path)
return fs.readFileSync(path, encoding)
}

function choose_file(show_dialog_options={}) { //todo document
Expand Down Expand Up @@ -149,21 +150,25 @@ function adjust_path_to_os(path){
}
}

function is_root_path(path){
return starts_with_one_of(path, ["/", "C:", "D:", "E:", "F:", "G:"]) //C: etc. is for Windows OS.
}

//______new load_files syncchronous______
//verify all paths first before loading any of them because we want to error early.
function load_files(...paths) {
let prefix = dde_apps_dir + "/"
let resolved_paths = []
for (let path of paths){
path = convert_backslashes_to_slashes(path) //use slashes throughout.
if (path.startsWith("/")){
if (is_root_path(path)){ //path.startsWith("/")
let last_slash_pos = path.lastIndexOf("/")
prefix = path.substring(0, last_slash_pos + 1) // prefix always starts and ends with a slash
}
else { path = prefix + path }
if (path.endsWith(".js")){resolved_paths.push(path)}
else if (path.endsWith("/")){ //this path is not loadable, its just to setup prefix for the next path
if (path.startsWith("/")) { //we've got a new prefix
if (is_root_path(path)) { //we've got a new prefix
prefix = path
}
else {
Expand Down

0 comments on commit e857e74

Please sign in to comment.