DEADSOFTWARE

opts: add option --wads-dir
[d2df-editor.git] / src / editor / f_addresource.pas
index 7703ab231a1324ae5b4db1c0600a6079b6a59c58..d67765e20d111ae91e253ee8350953e1a46ff8c4 100644 (file)
@@ -45,7 +45,7 @@ var
 implementation
 
 uses
-  f_main, WADSTRUCT, g_language, utils, sfs;
+  f_main, WADSTRUCT, g_language, utils, sfs, g_options;
 
 {$R *.lfm}
 
@@ -64,8 +64,7 @@ begin
   FFullResourceName := '';
   FResourceSelected := False;
 
-  ChDir(EditorDir);
-  if FindFirst(EditorDir + 'wads/*.*', faAnyFile, SR) = 0 then
+  if FindFirst(WadsDir + DirectorySeparator + '*.*', faAnyFile, SR) = 0 then
   repeat
     if (SR.name <> '.') and (SR.name <> '..') then
       cbWADList.Items.Add(SR.Name);
@@ -109,7 +108,7 @@ procedure TAddResourceForm.cbWADListChange(Sender: TObject);
     FileName, Section, sn, rn: String;
 begin
   if cbWADList.Text <> _lc[I_WAD_SPECIAL_MAP] then
-    FileName := EditorDir + 'wads/' + cbWADList.Text (* Resource wad *)
+    FileName := WadsDir + DirectorySeparator + cbWADList.Text (* Resource wad *)
   else
     g_ProcessResourceStr(OpenedMap, FileName, sn, rn); (* Map wad *)
 
@@ -139,7 +138,7 @@ procedure TAddResourceForm.cbSectionsListChange(Sender: TObject);
     FileName, Section, SectionName, sn, rn: String;
 begin
   if cbWADList.Text <> _lc[I_WAD_SPECIAL_MAP] then
-    FileName := EditorDir + 'wads/' + cbWADList.Text (* Resource wad *)
+    FileName := WadsDir + DirectorySeparator + cbWADList.Text (* Resource wad *)
   else
     g_ProcessResourceStr(OpenedMap, FileName, sn, rn); (* Map wad *)
 
@@ -180,7 +179,7 @@ begin
 
   g_ProcessResourceStr(OpenedMap, @fn, nil, nil);
   if FileName <> '' then
-    FFullResourceName := EditorDir + 'wads/' + FResourceName
+    FFullResourceName := WadsDir + DirectorySeparator + FResourceName
   else
     FFullResourceName := fn + FResourceName
 end;