Skip to content

Commit

Permalink
Simplify lift-ranges file finding
Browse files Browse the repository at this point in the history
  • Loading branch information
imnasnainaec committed Nov 8, 2023
1 parent f4dfc40 commit c2f791a
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions Backend/Services/LiftService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -318,17 +318,13 @@ public async Task<string> LiftExport(

// Export semantic domains to lift-ranges
var extractedPathToImport = FileStorage.GenerateImportExtractedLocationDirPath(projectId, false);
string? firstImportDir = null;
var rangesSrc = "";
if (Directory.Exists(extractedPathToImport))
{
// TODO: Should an error be raised if this returns null?
firstImportDir = Directory.GetDirectories(extractedPathToImport).Select(
Path.GetFileName).ToList().Single();
rangesSrc = Directory.GetFiles(
extractedPathToImport, "*.lift-ranges", SearchOption.AllDirectories).FirstOrDefault();
}

var rangesSrc = Directory.GetFiles(
Path.Combine(extractedPathToImport, firstImportDir ?? ""), "*.lift-ranges").FirstOrDefault();

// If there are no new semantic domains, and the old lift-ranges file is still around, just copy it
if (proj.SemanticDomains.Count == 0 && File.Exists(rangesSrc))
{
Expand Down

0 comments on commit c2f791a

Please sign in to comment.