Firefox自动删除配置文件夹中的xpi文件夹
问题描述:
我创建了一个Firefox附加组件。Firefox自动删除配置文件夹中的xpi文件夹
现在,当我手动将它放入当前的Profiles文件夹并加载浏览器时,它会提示安装。 但是,当我使用VC++可执行文件将.xpi文件复制到当前配置文件文件夹,然后重新加载浏览器时,它会自动删除.xpi文件。
请指导哪里出问题了。我相信通过VC++可执行文件进行复制会引发一些问题。
下面是相同的代码:
FILE* pnReadFile = fopen(spnDirPtr->d_name, "r");
if (pnReadFile)
{
char strDestFileName[MAX] = { 0 };
sprintf(strDestFileName, "%s\%s", arDestPath, xpi);
FILE* pnWriteFile = fopen(strDestFileName, "w"); /*File Pointer to write in file*/
if (pnWriteFile)
{
char buffer[MAX] = { 0 }; /*Buffer to store files content*/
while (fgets(buffer, MAX, pnReadFile))
{
fputs(buffer, pnWriteFile);
}
fclose(pnWriteFile);
}
else
{
printf("\n Unable to open file %s", strDestFileName);
}
fclose(pnReadFile);
}
答
我能找出相同。文件I/O方法没有完全复制xpi,因为xpi已经损坏,因此在Firefox加载时自动删除。我使用了system()copy命令,并且能够成功完成相同的操作。
感谢您的知识分享! – Noitidart