~azzar1/unity/add-show-desktop-key

« back to all changes in this revision

Viewing changes to www/media/console/console.js

  • Committer: dcoles
  • Date: 2008-07-15 06:10:20 UTC
  • Revision ID: svn-v3-trunk0:2b9c9e99-6f39-0410-b283-7f802c844ae2:trunk:872
Console: Allow console to be started with a set working directory (defaults to 
home)

Show diffs side-by-side

added added

removed removed

Lines of Context:
63
63
            if (callback != null)
64
64
                callback();
65
65
        }
66
 
    ajax_call(callback1, "consoleservice", "start", {}, "POST");
 
66
 
 
67
    //var current_path;
 
68
    if(typeof(current_path) != 'undefined')
 
69
    {
 
70
        // We have a current_path - give a suggestion to the server
 
71
        var path;
 
72
        if (current_file.isdir)
 
73
        {
 
74
            // Browser
 
75
            path = path_join("/home", current_path);
 
76
        }
 
77
        else
 
78
        {
 
79
            // Editor - need to chop off filename
 
80
            var tmp_path = current_path.split('/');
 
81
            tmp_path.pop();
 
82
            path = path_join("/home", tmp_path.join('/'));
 
83
        }
 
84
        ajax_call(callback1, "consoleservice", "start", {"startdir": path}, "POST");
 
85
    }
 
86
    else
 
87
    {
 
88
        // No current_path - let the server decide
 
89
        ajax_call(callback1, "consoleservice", "start", {}, "POST");
 
90
    }
67
91
}
68
92
 
69
93
/** Initialises the console. All apps which import console are required to