Skip to content

Commit 2e74649

Browse files
[#51] Address review: case-sensitive archive names, fix doc link and comments
- Compare archive names case-sensitively so the code matches the case-sensitive archives.name UNIQUE constraint and the name as it exists on the file system (drops the OrdinalIgnoreCase set). - Fix the comparing-builds.md link to be same-folder relative. - Clarify the schema comment and a test comment.
1 parent 6392bf4 commit 2e74649

4 files changed

Lines changed: 10 additions & 7 deletions

File tree

Analyzer/Resources/Init.sql

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,10 @@ CREATE TABLE IF NOT EXISTS types
88
-- Describes a unity archive that contains serialized files and other built content.
99
-- A common use of the unity archive is for AssetBundles but it can also be used for
1010
-- Player, Content Archive and ContentDirectory builds.
11-
-- name is UNIQUE: analyze only supports a single build, so two archives with the same name would
12-
-- make queries ambiguous. A duplicate is caught in code and reported (see AnalyzeDuplicateException);
13-
-- the constraint is the durable backstop for that invariant.
11+
-- name is UNIQUE (case-sensitive, matching the name on the file system): analyze only supports a
12+
-- single build, so two archives with the same name would make queries ambiguous. A duplicate is
13+
-- caught in code and reported (see AnalyzeDuplicateException); the constraint is the durable
14+
-- backstop for that invariant.
1415
CREATE TABLE IF NOT EXISTS archives
1516
(
1617
id INTEGER,

Analyzer/SQLite/Writers/SerializedFileSQLiteWriter.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,9 @@ public class SerializedFileSQLiteWriter : IDisposable
2222
// Names/ids already written to the archives and serialized_files tables, used to reject a
2323
// second copy of the same content with a clear error instead of a raw UNIQUE constraint
2424
// failure. Only a single build can be analyzed at a time (see AnalyzeDuplicateException).
25-
private HashSet<string> m_WrittenArchiveNames = new(StringComparer.OrdinalIgnoreCase);
25+
// Archive names are compared case-sensitively, matching the archives.name schema constraint
26+
// and the name as it exists on the file system.
27+
private HashSet<string> m_WrittenArchiveNames = new();
2628
private HashSet<int> m_WrittenSerializedFileIds = new();
2729

2830
private bool m_SkipReferences;

Documentation/command-analyze.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ This is expected when the input contains more than one build, and in these commo
183183
| Player scenes with the same file name (`level0`, …) from different builds | Analyze each build separately |
184184

185185
To compare two builds, analyze each into a separate database and query across them — see
186-
[Comparing Builds](../../Documentation/comparing-builds.md).
186+
[Comparing Builds](comparing-builds.md).
187187

188188
### Slow Analyze times, large output database
189189

UnityDataTool.Tests/AnalyzeDuplicateNameTests.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,8 @@ public void Teardown()
5555
}
5656

5757
// Case 2 / Case 3: two build folders each contain an archive named "assetbundle" (and "scenes").
58-
// The second archive of each name is rejected before it is opened, so exactly one row per name
59-
// survives and no UNIQUE constraint error is shown.
58+
// The second archive of each name is rejected before it is recorded (its contents are never
59+
// processed), so exactly one row per name survives and no UNIQUE constraint error is shown.
6060
[Test]
6161
public async Task Analyze_ArchivesWithSameName_SkippedWithClearMessage()
6262
{

0 commit comments

Comments
 (0)