mirror of
https://github.com/CopterExpress/clover.git
synced 2026-05-26 11:43:25 +00:00
Make update not a node
This commit is contained in:
@@ -16,13 +16,13 @@ import shutil
|
||||
import rospy
|
||||
import rospkg
|
||||
|
||||
rospy.init_node('roswww_static')
|
||||
#rospy.init_node('roswww_static')
|
||||
|
||||
rospack = rospkg.RosPack()
|
||||
|
||||
www = rospkg.get_ros_home() + '/www'
|
||||
index_file = rospy.get_param('~index_file', None)
|
||||
default_package = rospy.get_param('~default_package', None)
|
||||
index_file = None # rospy.get_param('~index_file', None)
|
||||
default_package = None # rospy.get_param('~default_package', None)
|
||||
|
||||
shutil.rmtree(www, ignore_errors=True) # reset www directory content
|
||||
os.mkdir(www)
|
||||
@@ -34,7 +34,7 @@ index = '<h1>Packages list</h1>\n<ul>\n'
|
||||
for name in packages:
|
||||
path = rospack.get_path(name)
|
||||
if os.path.exists(path + '/www'):
|
||||
rospy.loginfo('found www path for %s package', name)
|
||||
print('roswww_static: found www path for %s package', name)
|
||||
os.symlink(path + '/www', www + '/' + name)
|
||||
index += '<li><a href="{name}/">{name}</a></li>'.format(name=name)
|
||||
|
||||
@@ -42,7 +42,7 @@ if default_package is not None:
|
||||
redirect_html = '<meta http-equiv=refresh content="0; url={name}/">'.format(name=default_package)
|
||||
open(www + '/index.html', 'w').write(redirect_html)
|
||||
elif index_file is not None:
|
||||
rospy.loginfo('symlinking index file')
|
||||
print('roswww_static: symlinking index file')
|
||||
os.symlink(index_file, www + '/index.html')
|
||||
else:
|
||||
open(www + '/index.html', 'w').write(index)
|
||||
|
||||
Reference in New Issue
Block a user