Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
A
ardublockly
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
xpstem
ardublockly
Commits
d8c03033
Commit
d8c03033
authored
Feb 09, 2015
by
carlosperate
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
More robust path management. Useful for py2exe packaging.
parent
f80e1b4b
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
10 deletions
+15
-10
ArduinoServerCompiler/ServerCompilerSettings.py
ArduinoServerCompiler/ServerCompilerSettings.py
+3
-2
launch_arduino.py
launch_arduino.py
+12
-8
No files found.
ArduinoServerCompiler/ServerCompilerSettings.py
View file @
d8c03033
...
...
@@ -565,8 +565,9 @@ class ServerCompilerSettings(object):
:return: path to the settings file
"""
if
not
self
.
__settings_path__
:
self
.
__settings_path__
=
os
.
path
.
join
(
os
.
path
.
dirname
(
__file__
),
self
.
__settings_filename__
)
this_package_dir
=
os
.
path
.
dirname
(
os
.
path
.
realpath
(
__file__
))
self
.
__settings_path__
=
os
.
path
.
normpath
(
os
.
path
.
join
(
this_package_dir
,
self
.
__settings_filename__
))
return
self
.
__settings_path__
def
get_board_value_from_key
(
self
,
string_key
):
...
...
launch_arduino.py
View file @
d8c03033
...
...
@@ -94,22 +94,26 @@ def main(argv):
# with the parent folder of where this script is executed, done to be able
# to find the closure lib directory on the same level as the project folder
print
(
"
\n
======= Starting Server ======="
)
this_file_dir
=
os
.
path
.
dirname
(
os
.
path
.
realpath
(
sys
.
argv
[
0
]))
this_file_parent_dir
=
\
os
.
path
.
dirname
(
os
.
path
.
dirname
(
os
.
path
.
realpath
(
sys
.
argv
[
0
])))
try
:
server_root
except
NameError
:
server_root
=
os
.
path
.
dirname
(
this_file_dir
)
server_root
=
this_file_parent_dir
# Opening the browser to the web-app
paths
=
[
server_root
,
this_file_dir
]
paths
=
[
server_root
,
this_file_
parent_
dir
]
common_path
=
os
.
path
.
commonprefix
(
paths
)
if
not
common_path
:
print
(
'The server working directory and Ardublockly project need to '
+
'be in the same root directory!'
)
'be in the same root directory.!'
+
'The server root also needs to be at least one directory up '
+
'from the Ardublockly folder!'
)
sys
.
exit
(
1
)
relative_path
=
[
os
.
path
.
relpath
(
this_file_dir
,
common_path
)]
app_index
=
os
.
path
.
join
(
relative_path
[
0
],
'apps'
,
'arduino_material'
)
#print('Root & this file: %s\nCommon & relative path: %s; %s\nIndex: %s' %
# (paths, common_path, relative_path, app_index))
relative_path
=
[
os
.
path
.
relpath
(
this_file_parent_dir
,
common_path
)]
app_index
=
os
.
path
.
normpath
(
os
.
path
.
join
(
relative_path
[
0
],
'ardublockly'
,
'apps'
,
'arduino_material'
))
print
(
'Root & script parent: %s
\n
Common & relative path: %s; %s
\n
Index: %s'
%
(
paths
,
common_path
,
relative_path
,
app_index
))
open_browser
(
app_index
)
ArduinoServerCompiler
.
BlocklyHTTPServer
.
start_server
(
server_root
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment