View Issue Details

IDProjectCategoryView StatusLast Update
0002594FSSCPFREDpublic2012-02-16 13:54
ReporterCommanderDJ Assigned ToCommanderDJ  
PrioritynormalSeverityminorReproducibilityalways
Status resolvedResolutionfixed 
Product Version3.7.2 
Summary0002594: Opening a mission file results in a new mission being opened in FRED
DescriptionThis may go as far back as retail. If you double click (or otherwise "open") an .fs2 file, FRED will open but not with the file loaded. Instead, you'll get just a new mission as if you had opened FRED itself.
TagsNo tags attached.

Activities

iss_mneur

2012-01-31 06:15

developer   ~0013207

This is caused by FRED not actually checking its commandline to see if there is a file to open on startup.

chief1983

2012-01-31 19:40

administrator   ~0013211

I'd argue that since this goes all the way back to retail, this is more of a feature request than a bug.

iss_mneur

2012-02-01 06:03

developer   ~0013218

And I would argue (as I told CommanderDJ last night) that this bug is describing something that is not working as expected so it is a bug.

chief1983

2012-02-01 06:42

administrator   ~0013219

In ten years, how many people have expected that if you manually associate mission files with FRED, something FRED doesn't do itself for very good reason, that it would know what to do with it? First I've heard of someone trying in half that time.

The_E

2012-02-01 10:19

administrator   ~0013221

This is a feature request, not a bug report. As chief said, FRED does not register the .fs2 extension for the very reason that it doesn't know how to handle it. Would be nice if it did, but since for the past 12 years it didn't, a feature request it is.

iss_mneur

2012-02-02 07:03

developer   ~0013230

Personally, I did think it was odd that FRED didn't associate itself with the .fs2 files but I never investigated further because I don't use FRED to do anything other than to make a few test missions.

At that, last I talked to CommanderDJ he figured that he may have handle of fixing this bug anyway.

CommanderDJ

2012-02-14 00:30

developer   ~0013306

So I've messed around with this briefly. I've got it opening a prompt to open a mission if you double-click on a file... but it's already got a mission name in the filename field that is completely unrelated to the file it's supposed to be opening. I need to find a way to access the name of the file that was double-clicked.

chief1983

2012-02-14 15:50

administrator   ~0013327

There should be a standard method that Windows uses to pass that to the executable, whether it's command line or whatever. Should be plenty of docs on accessing that info. Might need to see how Windows sets up a file association by default if the app doesn't add itself to the registry automatically.

CommanderDJ

2012-02-15 11:49

developer  

mantis2594.patch (542 bytes)   
Index: code/fred2/fred.cpp
===================================================================
--- code/fred2/fred.cpp	(revision 8505)
+++ code/fred2/fred.cpp	(working copy)
@@ -254,7 +254,15 @@
 
 	m_nCmdShow = Main_wnd_data.p.showCmd;
 
-	OnFileNew();
+	//if we're opening a file, actually open it instead of just a new window
+	if(cmdInfo.m_nShellCommand == CCommandLineInfo::FileOpen)
+	{
+		AfxGetApp()->OpenDocumentFile((LPCTSTR)cmdInfo.m_strFileName);
+	}
+	else
+	{
+		OnFileNew();
+	}
 
 	if(m_pMainWnd == NULL) return FALSE;
 
mantis2594.patch (542 bytes)   

CommanderDJ

2012-02-15 11:49

developer   ~0013328

Took a bit of digging, but I've got this working now. Patch attached. Feedback appreciated.

chief1983

2012-02-15 16:03

administrator   ~0013329

Changing status to Code Review. Assuming the string handling is good, it looks fine to me.

The_E

2012-02-16 13:54

administrator   ~0013332

Fix committed to trunk@8515.

Related Changesets

fs2open: trunk r8515

2012-02-16 08:54

The_E


Ported: N/A

Details Diff
From CommanderDJ: Fix for Mantis 2594 (FRED is unable to open mission files from the commandline or shell) Affected Issues
0002594
mod - /trunk/fs2_open/code/fred2/fred.cpp Diff File

Issue History

Date Modified Username Field Change
2012-01-31 06:14 CommanderDJ New Issue
2012-01-31 06:15 iss_mneur Note Added: 0013207
2012-01-31 06:15 iss_mneur Product Version => 3.7.2
2012-01-31 06:15 iss_mneur Assigned To => iss_mneur
2012-01-31 06:15 iss_mneur Status new => acknowledged
2012-01-31 06:16 iss_mneur Assigned To iss_mneur =>
2012-01-31 19:40 chief1983 Note Added: 0013211
2012-02-01 06:03 iss_mneur Note Added: 0013218
2012-02-01 06:42 chief1983 Note Added: 0013219
2012-02-01 10:19 The_E Note Added: 0013221
2012-02-02 07:03 iss_mneur Note Added: 0013230
2012-02-02 07:03 iss_mneur Status acknowledged => confirmed
2012-02-14 00:12 CommanderDJ Assigned To => CommanderDJ
2012-02-14 00:12 CommanderDJ Status confirmed => assigned
2012-02-14 00:30 CommanderDJ Note Added: 0013306
2012-02-14 15:50 chief1983 Note Added: 0013327
2012-02-15 11:49 CommanderDJ File Added: mantis2594.patch
2012-02-15 11:49 CommanderDJ Note Added: 0013328
2012-02-15 16:03 chief1983 Note Added: 0013329
2012-02-15 16:03 chief1983 Status assigned => code review
2012-02-16 13:54 The_E Changeset attached => fs2open trunk r8515
2012-02-16 13:54 The_E Note Added: 0013332
2012-02-16 13:54 The_E Status code review => resolved
2012-02-16 13:54 The_E Resolution open => fixed