diff --git a/src/function/treeView/command.ts b/src/function/treeView/command.ts index 3798666..0937471 100644 --- a/src/function/treeView/command.ts +++ b/src/function/treeView/command.ts @@ -245,18 +245,27 @@ export async function clean() { const plName = opeParam.prjInfo.prjName.PL; const targetPath = fspath.dirname(opeParam.prjInfo.arch.hardware.src); - let type = 'srcs'; if (hdlDir.isDir(`${workspacePath}/prj/xilinx/${plName}.gen`)) { - type = 'gen'; + const sourceIpPath = `${workspacePath}/prj/xilinx/${plName}.gen/sources_1/ip`; + const sourceBdPath = `${workspacePath}/prj/xilinx/${plName}.gen/sources_1/bd`; + + hdlDir.mvdir(sourceIpPath, targetPath, true); + MainOutput.report("move dir from " + sourceIpPath + " to " + targetPath); + + hdlDir.mvdir(sourceBdPath, targetPath, true); + MainOutput.report("move dir from " + sourceBdPath + " to " + targetPath); } - const sourceIpPath = `${workspacePath}/prj/xilinx/${plName}.${type}/sources_1/ip`; - const sourceBdPath = `${workspacePath}/prj/xilinx/${plName}.${type}/sources_1/bd`; - hdlDir.mvdir(sourceIpPath, targetPath, true); - MainOutput.report("move dir from " + sourceIpPath + " to " + targetPath); + if (hdlDir.isDir(`${workspacePath}/prj/xilinx/${plName}.srcs`)) { + const sourceIpPath = `${workspacePath}/prj/xilinx/${plName}.srcs/sources_1/ip`; + const sourceBdPath = `${workspacePath}/prj/xilinx/${plName}.srcs/sources_1/bd`; - hdlDir.mvdir(sourceBdPath, targetPath, true); - MainOutput.report("move dir from " + sourceBdPath + " to " + targetPath); + hdlDir.mvdir(sourceIpPath, targetPath, true); + MainOutput.report("move dir from " + sourceIpPath + " to " + targetPath); + + hdlDir.mvdir(sourceBdPath, targetPath, true); + MainOutput.report("move dir from " + sourceBdPath + " to " + targetPath); + } if (prjPath !== opeParam.workspacePath) { hdlDir.rmdir(prjPath); diff --git a/src/manager/PL/xilinx.ts b/src/manager/PL/xilinx.ts index 06a2891..e2284f9 100644 --- a/src/manager/PL/xilinx.ts +++ b/src/manager/PL/xilinx.ts @@ -286,19 +286,27 @@ class XilinxOperation { const plName = opeParam.prjInfo.prjName.PL; const targetPath = fspath.dirname(opeParam.prjInfo.arch.hardware.src); - let type = 'srcs'; - if (hdlDir.isDir(`${workspacePath}/prj/xilinx/${plName}.gen`)) { - type = 'gen' + if (hdlDir.isDir(`${workspacePath}/prj/xilinx/${plName}.gen`)) { + const sourceIpPath = `${workspacePath}/prj/xilinx/${plName}.gen/sources_1/ip`; + const sourceBdPath = `${workspacePath}/prj/xilinx/${plName}.gen/sources_1/bd`; + + hdlDir.mvdir(sourceIpPath, targetPath, true); + HardwareOutput.report("move dir from " + sourceIpPath + " to " + targetPath); + + hdlDir.mvdir(sourceBdPath, targetPath, true); + HardwareOutput.report("move dir from " + sourceBdPath + " to " + targetPath); } - const sourceIpPath = `${workspacePath}/prj/xilinx/${plName}.${type}/sources_1/ip`; - const sourceBdPath = `${workspacePath}/prj/xilinx/${plName}.${type}/sources_1/bd`; - - hdlDir.mvdir(sourceIpPath, targetPath, true); - HardwareOutput.report("move dir from " + sourceIpPath + " to " + targetPath); - - hdlDir.mvdir(sourceBdPath, targetPath, true); - HardwareOutput.report("move dir from " + sourceBdPath + " to " + targetPath); + if (hdlDir.isDir(`${workspacePath}/prj/xilinx/${plName}.srcs`)) { + const sourceIpPath = `${workspacePath}/prj/xilinx/${plName}.srcs/sources_1/ip`; + const sourceBdPath = `${workspacePath}/prj/xilinx/${plName}.srcs/sources_1/bd`; + + hdlDir.mvdir(sourceIpPath, targetPath, true); + HardwareOutput.report("move dir from " + sourceIpPath + " to " + targetPath); + + hdlDir.mvdir(sourceBdPath, targetPath, true); + HardwareOutput.report("move dir from " + sourceBdPath + " to " + targetPath); + } await this.closeAllWindows(); } diff --git a/src/manager/prj.ts b/src/manager/prj.ts index ad635f8..645322d 100644 --- a/src/manager/prj.ts +++ b/src/manager/prj.ts @@ -398,27 +398,44 @@ class PrjManage { workspace: string, plname: string ) { - let standardIpPath = hdlPath.join(workspace, 'user', 'ip'); - let xilinxSrcsPath = hdlPath.join(workspace, plname + '.gen'); - if (!fs.existsSync(xilinxSrcsPath)) { - xilinxSrcsPath = hdlPath.join(workspace, plname + '.srcs'); - if (!fs.existsSync(xilinxSrcsPath)) { - return; + const standardIpPath = hdlPath.join(workspace, 'user', 'ip'); + + if (hdlDir.isDir(hdlPath.join(workspace, plname + '.gen'))) { + const xilinxSrcsPath = hdlPath.join(workspace, plname + '.gen'); + + const sourceNames = fs.readdirSync(xilinxSrcsPath).filter(filename => filename.startsWith(matchPrefix)); + for (const sn of sourceNames) { + const ipPath = hdlPath.join(xilinxSrcsPath, sn, 'ip'); + + if (!hdlFile.isDir(ipPath)) { + continue; + } + + for (const ipname of fs.readdirSync(ipPath)) { + const sourcePath = hdlPath.join(ipPath, ipname); + hdlDir.mvdir(sourcePath, standardIpPath, true); + } + hdlDir.rmdir(ipPath); } } - const sourceNames = fs.readdirSync(xilinxSrcsPath).filter(filename => filename.startsWith(matchPrefix)); - for (const sn of sourceNames) { - const ipPath = hdlPath.join(xilinxSrcsPath, sn, 'ip'); - if (!hdlFile.isDir(ipPath)) { - continue; + if (hdlDir.isDir(hdlPath.join(workspace, plname + '.srcs'))) { + const xilinxSrcsPath = hdlPath.join(workspace, plname + '.srcs'); + + const sourceNames = fs.readdirSync(xilinxSrcsPath).filter(filename => filename.startsWith(matchPrefix)); + for (const sn of sourceNames) { + const ipPath = hdlPath.join(xilinxSrcsPath, sn, 'ip'); + + if (!hdlFile.isDir(ipPath)) { + continue; + } + + for (const ipname of fs.readdirSync(ipPath)) { + const sourcePath = hdlPath.join(ipPath, ipname); + hdlDir.mvdir(sourcePath, standardIpPath, true); + } + hdlDir.rmdir(ipPath); } - - for (const ipname of fs.readdirSync(ipPath)) { - const sourcePath = hdlPath.join(ipPath, ipname); - hdlDir.mvdir(sourcePath, standardIpPath, true); - } - hdlDir.rmdir(ipPath); } }