def symlink_objects_path_to_latest(objects_path):
"""Symlinks 'latest' to the given directory.
Args:
objects_path: Path to objects directory.
"""
objects_root = os.path.dirname(objects_path)
path_to_symlink = os.path.join(objects_root, "latest")
try:
os.symlink(objects_path, path_to_symlink)
except OSError as e:
# Replace the old symlink if an old symlink with the same
# name exists.
if e.errno == errno.EEXIST:
os.remove(path_to_symlink)
os.symlink(objects_path, path_to_symlink)
else:
rospy.logerr(
"Could not create symlink to the latest objects directory")
评论列表
文章目录