Skip to content

Commit 674e7c7

Browse files
authored
Merge pull request #210 from delibae/fix/hide-compiled-build-artifacts
fix: hide compiled build artifacts from project file tree
2 parents 67dde77 + 28f6190 commit 674e7c7

2 files changed

Lines changed: 14 additions & 6 deletions

File tree

‎apps/desktop/src/__tests__/lib/tauri-fs.test.ts‎

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,18 +23,19 @@ describe("tauri fs helpers", () => {
2323
expect(getProjectFileType("script.py")).toBe("other");
2424
});
2525

26-
it("ignores LaTeX build artifacts", () => {
26+
it("ignores LaTeX and compiled build artifacts", () => {
2727
expect(getProjectFileType("main.aux")).toBeNull();
2828
expect(getProjectFileType("main.synctex.gz")).toBeNull();
29+
expect(getProjectFileType("module.pyc")).toBeNull();
30+
expect(getProjectFileType("native.pyd")).toBeNull();
31+
expect(getProjectFileType("libnative.so")).toBeNull();
2932
});
3033

3134
it("keeps imported files with arbitrary extensions visible", () => {
3235
expect(getProjectFileType("archive.zip")).toBe("other");
3336
expect(getProjectFileType("paper.docx")).toBe("other");
3437
expect(getProjectFileType("data.xlsx")).toBe("other");
3538
expect(getProjectFileType("movie.mp4")).toBe("other");
36-
expect(getProjectFileType("module.pyc")).toBe("other");
37-
expect(getProjectFileType("native.pyd")).toBe("other");
3839
});
3940
});
4041

@@ -90,7 +91,6 @@ describe("tauri fs helpers", () => {
9091

9192
it("keeps arbitrary file formats visible as other files", async () => {
9293
vi.mocked(readDir).mockResolvedValue([
93-
{ name: "module.pyc", isDirectory: false },
9494
{ name: "worker.py", isDirectory: false },
9595
{ name: "notes.txt", isDirectory: false },
9696
] as any);
@@ -99,11 +99,10 @@ describe("tauri fs helpers", () => {
9999
const result = await scanProjectFolder("/project");
100100

101101
expect(result.files.map((file) => file.relativePath)).toEqual([
102-
"module.pyc",
103102
"worker.py",
104103
"notes.txt",
105104
]);
106-
expect(stat).toHaveBeenCalledTimes(3);
105+
expect(stat).toHaveBeenCalledTimes(2);
107106
expect(result.files.every((file) => file.type === "other")).toBe(true);
108107
});
109108
});

‎apps/desktop/src/lib/tauri/fs.ts‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,15 @@ const IGNORED_EXTENSIONS = new Set([
8181
".vrb",
8282
".run.xml",
8383
".bcf",
84+
// Compiled build artifacts (never user reference material)
85+
".pyc",
86+
".pyo",
87+
".pyd",
88+
".o",
89+
".obj",
90+
".so",
91+
".dylib",
92+
".dll",
8493
]);
8594

8695
export function shouldSkipProjectDirectory(name: string): boolean {

0 commit comments

Comments
 (0)