You might have noticed that on occasion the "acdbHostApplicationServices()->workingDatabase()->getFilename( pFileName )" returns the name of the temporary save file rather than the name of actual file that is open. This is as designed.
AcDbDatabase::originalFileName() function retrieves the file name under which the drawing is originally opened. In addition, AcApDocument::fileName() function also can retrieve the actual file full path.