fix gen file issues

This commit is contained in:
Nitcloud 2025-03-16 15:29:52 +08:00
parent b949289ece
commit f372aa4db0
3 changed files with 70 additions and 36 deletions

View File

@ -245,18 +245,27 @@ export async function clean() {
const plName = opeParam.prjInfo.prjName.PL; const plName = opeParam.prjInfo.prjName.PL;
const targetPath = fspath.dirname(opeParam.prjInfo.arch.hardware.src); const targetPath = fspath.dirname(opeParam.prjInfo.arch.hardware.src);
let type = 'srcs';
if (hdlDir.isDir(`${workspacePath}/prj/xilinx/${plName}.gen`)) { 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); if (hdlDir.isDir(`${workspacePath}/prj/xilinx/${plName}.srcs`)) {
MainOutput.report("move dir from " + sourceIpPath + " to " + targetPath); 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); hdlDir.mvdir(sourceIpPath, targetPath, true);
MainOutput.report("move dir from " + sourceBdPath + " to " + targetPath); 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) { if (prjPath !== opeParam.workspacePath) {
hdlDir.rmdir(prjPath); hdlDir.rmdir(prjPath);

View File

@ -286,19 +286,27 @@ class XilinxOperation {
const plName = opeParam.prjInfo.prjName.PL; const plName = opeParam.prjInfo.prjName.PL;
const targetPath = fspath.dirname(opeParam.prjInfo.arch.hardware.src); const targetPath = fspath.dirname(opeParam.prjInfo.arch.hardware.src);
let type = 'srcs';
if (hdlDir.isDir(`${workspacePath}/prj/xilinx/${plName}.gen`)) { 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);
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`; if (hdlDir.isDir(`${workspacePath}/prj/xilinx/${plName}.srcs`)) {
const sourceBdPath = `${workspacePath}/prj/xilinx/${plName}.${type}/sources_1/bd`; 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); hdlDir.mvdir(sourceIpPath, targetPath, true);
HardwareOutput.report("move dir from " + sourceIpPath + " to " + targetPath); HardwareOutput.report("move dir from " + sourceIpPath + " to " + targetPath);
hdlDir.mvdir(sourceBdPath, targetPath, true); hdlDir.mvdir(sourceBdPath, targetPath, true);
HardwareOutput.report("move dir from " + sourceBdPath + " to " + targetPath); HardwareOutput.report("move dir from " + sourceBdPath + " to " + targetPath);
}
await this.closeAllWindows(); await this.closeAllWindows();
} }

View File

@ -398,27 +398,44 @@ class PrjManage {
workspace: string, workspace: string,
plname: string plname: string
) { ) {
let standardIpPath = hdlPath.join(workspace, 'user', 'ip'); const standardIpPath = hdlPath.join(workspace, 'user', 'ip');
let xilinxSrcsPath = hdlPath.join(workspace, plname + '.gen');
if (!fs.existsSync(xilinxSrcsPath)) { if (hdlDir.isDir(hdlPath.join(workspace, plname + '.gen'))) {
xilinxSrcsPath = hdlPath.join(workspace, plname + '.srcs'); const xilinxSrcsPath = hdlPath.join(workspace, plname + '.gen');
if (!fs.existsSync(xilinxSrcsPath)) {
return; 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)) { if (hdlDir.isDir(hdlPath.join(workspace, plname + '.srcs'))) {
continue; const xilinxSrcsPath = hdlPath.join(workspace, plname + '.srcs');
}
for (const ipname of fs.readdirSync(ipPath)) { const sourceNames = fs.readdirSync(xilinxSrcsPath).filter(filename => filename.startsWith(matchPrefix));
const sourcePath = hdlPath.join(ipPath, ipname); for (const sn of sourceNames) {
hdlDir.mvdir(sourcePath, standardIpPath, true); 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);
} }
hdlDir.rmdir(ipPath);
} }
} }