get_app_info

1. Introduction

Get Blockly project directory information.

2. Request & Response

{
    "cmd": "get_app_info",
    "data": {
        "userId": "test",
        "version": "lite6"
    },
    "id": "1"
}

3. Code Example

background

user_id = data.get('userId', 'test')
xarm_version = data.get('version', GLOBAL.XArm.xarm_type)
root_path = os.path.join(projects_path, user_id, xarm_version, 'app', 'myapp')
if not os.path.exists(root_path):
    os.makedirs(root_path)
code, result_dir = get_app_config(root_path, xarm_version)
select_file_path = result_dir['config']['selectFilePath']
if not os.path.exists(os.path.join(root_path, select_file_path.lstrip('/'))):
    result_dir['config']['selectFilePath'] = '/untitled'
    uf_app_config = result_dir['children'][0]['children']
    for item in uf_app_config:
        if os.path.exists(os.path.join(root_path, item['name'])):
            result_dir['config']['selectFilePath'] = item['uuid']
            break
response(client, cmd_id, code, data=result_dir)

front_end

self.getAppInfo = (callback) => {
  const params = window.GlobalConstant.INIT_CMD_PARAMS_COMMON_DATA();
  // Object.assign(params.data, {
  //   folderName: folderName,
  // });
  self.sendCmd(window.GlobalConstant.APP_GET_INFO, params, (dict) => {
    if (callback) {
	 callback(dict);
    }
  });
};

Last updated