@@ -162,7 +162,7 @@ public static bool RedistInstalled
162162 }
163163
164164 // Pointer to destination path textbox
165- private static string destinationPath = "" ;
165+ private static string destinationPath = Path . Combine ( Path . GetPathRoot ( AppDomain . CurrentDomain . BaseDirectory ) , "Flashpoint" ) ;
166166 public static string DestinationPath
167167 {
168168 get { return destinationPath ; }
@@ -274,6 +274,30 @@ public static TreeNode AddNodeToList(XmlNode child, TreeNodeCollection parent, b
274274 // Checks if specified Flashpoint destination path is valid
275275 public static bool VerifyDestinationPath ( string path )
276276 {
277+ bool alreadyExists = false ;
278+
279+ IterateXML ( XmlTree . GetElementsByTagName ( "list" ) [ 0 ] . ChildNodes , node =>
280+ {
281+ if ( node . Name != "component" ) return ;
282+
283+ if ( File . Exists ( Path . Combine ( path , "Components" , $ "{ new Component ( node ) . ID } .txt") ) )
284+ {
285+ alreadyExists = true ;
286+ return ;
287+ }
288+ } ) ;
289+
290+ if ( alreadyExists )
291+ {
292+ MessageBox . Show (
293+ "Flashpoint is already installed to this directory! " +
294+ "Choose a different folder or uninstall the existing copy first." ,
295+ "Error" , MessageBoxButtons . OK , MessageBoxIcon . Error
296+ ) ;
297+
298+ return false ;
299+ }
300+
277301 if ( ! Path . IsPathRooted ( path ) )
278302 {
279303 MessageBox . Show (
@@ -313,13 +337,13 @@ public static bool VerifyDestinationPath(string path)
313337 }
314338
315339 // Checks if any dependencies were not marked for download by the user, and marks them accordingly
316- public static void CheckDependencies ( TreeView sourceTree )
340+ public static void CheckDependencies ( )
317341 {
318342 List < string > requiredDepends = new List < string > ( ) ;
319343 List < string > missingDepends = new List < string > ( ) ;
320344
321345 // First, fill out a list of dependencies
322- IterateList ( sourceTree . Nodes , node =>
346+ IterateList ( Main . ComponentList . Nodes , node =>
323347 {
324348 if ( node . Checked && node . Tag . GetType ( ) . ToString ( ) . EndsWith ( "Component" ) )
325349 {
@@ -328,7 +352,7 @@ public static void CheckDependencies(TreeView sourceTree)
328352 } ) ;
329353
330354 // Then make sure they're all marked for installation
331- IterateList ( sourceTree . Nodes , node =>
355+ IterateList ( Main . ComponentList . Nodes , node =>
332356 {
333357 if ( node . Tag . GetType ( ) . ToString ( ) . EndsWith ( "Component" ) )
334358 {
0 commit comments