我正在为基于unix的/样式系统创建类似CCleaner的应用程序。
我无法确切了解Firefox保存其临时文件的位置,而Firefox开发社区中的人似乎并不愿意帮我找到哪些内容。
我至少知道Linux(现在是我的重点),临时文件保存在
中/home/user/.mozilla/firefox/*.default/
大多数临时文件都保存在Cache目录中,但不是全部。那么你们中是否有任何关于临时文件存储位置的提示或文档。
答案 0 :(得分:4)
通常,您有〜/ .mozilla / firefox / profile.default / Cache来保存缓存,但您也可以检查browser.cache.disk.parent_directory设置的位置。
您可以在用户的当前目录中找到user.js或/和prefs.js(〜/ .mozilla / firefox / profile.default /)。
答案 1 :(得分:0)
Windows上的Firefox使用SQLLite存储历史记录等,我使用代码来杀死FireFox进程,然后删除除sqllite文件之外的所有文件,这样就不会丢失书签。
using System;
using System.Collections.Generic;
using System.IO;
using System.Diagnostics;
using System.Text;
namespace Fidling
{
public static class SpywareRemoval
{
private static void RemoveSpywareFiles(string RootPath, string Path,bool Recursive)
{
string FullPath = RootPath + Path + "\\";
if (Directory.Exists(FullPath))
{
DirectoryInfo DInfo = new DirectoryInfo(FullPath);
FileAttributes Attr = DInfo.Attributes;
DInfo.Attributes = FileAttributes.Normal;
foreach (string FileName in Directory.GetFiles(FullPath))
{
RemoveSpywareFile(FileName);
}
if (Recursive)
{
foreach (string DirName in Directory.GetDirectories(FullPath))
{
RemoveSpywareFiles("", DirName, true);
try { Directory.Delete(DirName); }catch { }
}
}
DInfo.Attributes = Attr;
}
}
private static void RemoveSpywareFile(string FileName)
{
if (File.Exists(FileName))
{
try { File.Delete(FileName); }catch { }//Locked by something and you can forget trying to delete index.dat files this way
}
}
private static void DeleteFireFoxFiles(string FireFoxPath)
{
RemoveSpywareFile(FireFoxPath + "cookies.sqlite");
RemoveSpywareFile(FireFoxPath + "content-prefs.sqlite");
RemoveSpywareFile(FireFoxPath + "downloads.sqlite");
RemoveSpywareFile(FireFoxPath + "formhistory.sqlite");
RemoveSpywareFile(FireFoxPath + "search.sqlite");
RemoveSpywareFile(FireFoxPath + "signons.sqlite");
RemoveSpywareFile(FireFoxPath + "search.json");
RemoveSpywareFile(FireFoxPath + "permissions.sqlite");
}
public static void RunCleanup()
{
try { KillProcess("iexplore"); }
catch { }//Need to stop incase they have locked the files we want to delete
try { KillProcess("FireFox"); }
catch { }//Need to stop incase they have locked the files we want to delete
string RootPath = Environment.GetFolderPath(Environment.SpecialFolder.Personal).ToLower().Replace("documents", "");
RemoveSpywareFiles(RootPath, @"AppData\Roaming\Macromedia\Flash Player\#SharedObjects",false);
RemoveSpywareFiles(RootPath, @"AppData\Roaming\Macromedia\Flash Player\macromedia.com\support\flashplayer\sys\#local", false);
RemoveSpywareFiles(RootPath, @"AppData\Local\Temporary Internet Files", false);//Not working
RemoveSpywareFiles("", Environment.GetFolderPath(Environment.SpecialFolder.Cookies), true);
RemoveSpywareFiles("", Environment.GetFolderPath(Environment.SpecialFolder.InternetCache), true);
RemoveSpywareFiles("", Environment.GetFolderPath(Environment.SpecialFolder.History), true);
RemoveSpywareFiles(RootPath, @"AppData\Local\Microsoft\Windows\Wer", true);
RemoveSpywareFiles(RootPath, @"AppData\Local\Microsoft\Windows\Caches", false);
RemoveSpywareFiles(RootPath, @"AppData\Local\Microsoft\WebsiteCache", false);
RemoveSpywareFiles(RootPath, @"AppData\Local\Temp", false);
RemoveSpywareFiles(RootPath, @"AppData\LocalLow\Microsoft\CryptnetUrlCache", false);
RemoveSpywareFiles(RootPath, @"AppData\LocalLow\Apple Computer\QuickTime\downloads", false);
RemoveSpywareFiles(RootPath, @"AppData\Local\Mozilla\Firefox\Profiles", false);
RemoveSpywareFiles(RootPath, @"AppData\Roaming\Microsoft\Office\Recent", false);
RemoveSpywareFiles(RootPath, @"AppData\Roaming\Adobe\Flash Player\AssetCache", false);
if (Directory.Exists(RootPath + @"\AppData\Roaming\Mozilla\Firefox\Profiles"))
{
string FireFoxPath = RootPath + @"AppData\Roaming\Mozilla\Firefox\Profiles\";
DeleteFireFoxFiles(FireFoxPath);
foreach (string SubPath in Directory.GetDirectories(FireFoxPath))
{
DeleteFireFoxFiles(SubPath + "\\");
}
}
}
private static void KillProcess(string ProcessName)
{//We ned to kill Internet explorer and Firefox to stop them locking files
ProcessName = ProcessName.ToLower();
foreach (Process P in Process.GetProcesses())
{
if (P.ProcessName.ToLower().StartsWith(ProcessName))
P.Kill();
}
}
}
}
此代码还删除了Flash共享cookie以及更多内容,但我希望它有所帮助
答案 2 :(得分:0)
Firefox Temp文件位于(隐藏目录)~/.cache/mozilla/firefox/[profile_name]
中。至少在openSuSE Linux中用于任何最新版本。