Article 2F9BM Representative Line: The Installer Configuration

Representative Line: The Installer Configuration

by
Remy Porter
from The Daily WTF on (#2F9BM)

John N supports a C# project that, on first run, needs to initialize a database. It pulls that data from a dbInstallFilePath, controlled by the application .config file. This brings us to our representative line:

 <add key="dbInstallDbFilePath" value="C:\TestData\" />

Isn't that just terrible? Aren't you just cringing, or calling for the responsible developer to be sacked? Oh, wait, you're sitting here, scratching your head, wondering about how this is a WTF, aren't you? Let me provide a little more context.

 <!-- Stephen - 18th July 2013 ## ## IMPORTANT - DON'T put a backslash at the end of the path below!!!!! ## I don't know why, but it sometimes makes a difference that the DbFilePath config has to be specified WITHOUT the trailing backslash It seems that if a database is created using a path specifiecation that includes a single backslash, and an attempt is made to restore the database in-place (using WITH MOVE ... REPLACE), then it will fail if the restore command uses double backslash in the path, and similarly, restoring a database that was created with double backslash in the path will only restore safely if the restore specifies double backslash. REALLY DON'T PUT A BACKSLASH. EVER. --> <add key="dbInstallDbFilePath" value="C:\TestData\" /> 
release50.png[Advertisement] Release!is a light card game about software and the people who make it. Play with 2-5 people, or up to 10 with two copies - only $9.95 shipped! TheDailyWtf?d=yIl2AUoC8zAHARDzLQDo3I
External Content
Source RSS or Atom Feed
Feed Location http://syndication.thedailywtf.com/TheDailyWtf
Feed Title The Daily WTF
Feed Link http://thedailywtf.com/
Reply 0 comments