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 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);

View File

@ -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();
}

View File

@ -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);
}
}