mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-01 01:07:51 -04:00
integrate with some more code in plugin, fix a couple of bugs
This commit is contained in:
parent
3affab1849
commit
2a1299b294
@ -1,32 +1,21 @@
|
||||
Microsoft Visual Studio Solution File, Format Version 8.00
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "P3DActiveX", "P3DActiveX.vcproj", "{74451B00-2D87-412B-9359-B5CA2C2FEC2A}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
{1278896B-1978-40CC-B1A0-2D6A7450A32C} = {1278896B-1978-40CC-B1A0-2D6A7450A32C}
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "tinyxml", "..\..\..\wintools\sdk\tinyxml\tinyxml_lib_mfc_static.vcproj", "{1278896B-1978-40CC-B1A0-2D6A7450A32C}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfiguration) = preSolution
|
||||
Debug = Debug
|
||||
Release = Release
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectDependencies) = postSolution
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfiguration) = postSolution
|
||||
{74451B00-2D87-412B-9359-B5CA2C2FEC2A}.Debug.ActiveCfg = Debug|Win32
|
||||
{74451B00-2D87-412B-9359-B5CA2C2FEC2A}.Debug.Build.0 = Debug|Win32
|
||||
{74451B00-2D87-412B-9359-B5CA2C2FEC2A}.Release.ActiveCfg = Release|Win32
|
||||
{74451B00-2D87-412B-9359-B5CA2C2FEC2A}.Release.Build.0 = Release|Win32
|
||||
{1278896B-1978-40CC-B1A0-2D6A7450A32C}.Debug.ActiveCfg = Debug|Win32
|
||||
{1278896B-1978-40CC-B1A0-2D6A7450A32C}.Debug.Build.0 = Debug|Win32
|
||||
{1278896B-1978-40CC-B1A0-2D6A7450A32C}.Release.ActiveCfg = Release|Win32
|
||||
{1278896B-1978-40CC-B1A0-2D6A7450A32C}.Release.Build.0 = Release|Win32
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityAddIns) = postSolution
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
Microsoft Visual Studio Solution File, Format Version 8.00
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "P3DActiveX", "P3DActiveX.vcproj", "{74451B00-2D87-412B-9359-B5CA2C2FEC2A}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfiguration) = preSolution
|
||||
Debug = Debug
|
||||
Release = Release
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfiguration) = postSolution
|
||||
{74451B00-2D87-412B-9359-B5CA2C2FEC2A}.Debug.ActiveCfg = Debug|Win32
|
||||
{74451B00-2D87-412B-9359-B5CA2C2FEC2A}.Debug.Build.0 = Debug|Win32
|
||||
{74451B00-2D87-412B-9359-B5CA2C2FEC2A}.Release.ActiveCfg = Release|Win32
|
||||
{74451B00-2D87-412B-9359-B5CA2C2FEC2A}.Release.Build.0 = Release|Win32
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityAddIns) = postSolution
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
|
@ -1,258 +1,272 @@
|
||||
<?xml version="1.0" encoding="Windows-1252"?>
|
||||
<VisualStudioProject
|
||||
ProjectType="Visual C++"
|
||||
Version="7.10"
|
||||
Name="P3DActiveX"
|
||||
ProjectGUID="{74451B00-2D87-412B-9359-B5CA2C2FEC2A}"
|
||||
Keyword="MFCActiveXProj">
|
||||
<Platforms>
|
||||
<Platform
|
||||
Name="Win32"/>
|
||||
</Platforms>
|
||||
<Configurations>
|
||||
<Configuration
|
||||
Name="Debug|Win32"
|
||||
OutputDirectory="Debug"
|
||||
IntermediateDirectory="Debug"
|
||||
ConfigurationType="2"
|
||||
UseOfMFC="1"
|
||||
CharacterSet="2">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories="..\plugin;..\..\..\wintools\sdk\tinyxml"
|
||||
PreprocessorDefinitions="WIN32;_WINDOWS;_DEBUG;_USRDLL"
|
||||
MinimalRebuild="TRUE"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="0"
|
||||
TreatWChar_tAsBuiltInType="TRUE"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="3"
|
||||
Detect64BitPortabilityProblems="TRUE"
|
||||
DebugInformationFormat="3"/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
OutputFile="$(OutDir)/P3DActiveX.ocx"
|
||||
LinkIncremental="1"
|
||||
AdditionalLibraryDirectories="../../../wintools/built/lib"
|
||||
IgnoreDefaultLibraryNames="LIBCI.LIB MSVCRTD.LIB MSVCRT.LIB"
|
||||
ModuleDefinitionFile=".\P3DActiveX.def"
|
||||
GenerateDebugInformation="TRUE"
|
||||
SubSystem="2"
|
||||
ImportLibrary="$(OutDir)/P3DActiveX.lib"
|
||||
TargetMachine="1"
|
||||
FixedBaseAddress="1"/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
PreprocessorDefinitions="_DEBUG"
|
||||
MkTypLibCompatible="FALSE"
|
||||
TypeLibraryName="$(IntDir)/$(ProjectName).tlb"
|
||||
HeaderFileName="$(ProjectName)idl.h"/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
Description="Performing registration"
|
||||
CommandLine="regsvr32 /s /c "$(TargetPath)""/>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
PreprocessorDefinitions="_DEBUG"
|
||||
Culture="1033"
|
||||
AdditionalIncludeDirectories="$(IntDir)"/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCWebDeploymentTool"/>
|
||||
<Tool
|
||||
Name="VCManagedWrapperGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="Release|Win32"
|
||||
OutputDirectory="Release"
|
||||
IntermediateDirectory="Release"
|
||||
ConfigurationType="2"
|
||||
UseOfMFC="1"
|
||||
CharacterSet="2">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalIncludeDirectories="..\plugin;..\..\..\wintools\sdk\tinyxml"
|
||||
PreprocessorDefinitions="WIN32;_WINDOWS;NDEBUG;_USRDLL"
|
||||
RuntimeLibrary="0"
|
||||
TreatWChar_tAsBuiltInType="TRUE"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="3"
|
||||
Detect64BitPortabilityProblems="TRUE"
|
||||
DebugInformationFormat="3"/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
OutputFile="$(OutDir)/P3DActiveX.ocx"
|
||||
LinkIncremental="1"
|
||||
AdditionalLibraryDirectories="../../../wintools/built/lib"
|
||||
IgnoreDefaultLibraryNames="LIBCI.LIB MSVCRTD.LIB MSVCRT.LIB"
|
||||
ModuleDefinitionFile=".\P3DActiveX.def"
|
||||
GenerateDebugInformation="TRUE"
|
||||
SubSystem="2"
|
||||
OptimizeReferences="2"
|
||||
EnableCOMDATFolding="2"
|
||||
ImportLibrary="$(OutDir)/P3DActiveX.lib"
|
||||
TargetMachine="1"
|
||||
FixedBaseAddress="1"/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
PreprocessorDefinitions="NDEBUG"
|
||||
MkTypLibCompatible="FALSE"
|
||||
TypeLibraryName="$(IntDir)/$(ProjectName).tlb"
|
||||
HeaderFileName="$(ProjectName)idl.h"/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
Description="Performing registration"
|
||||
CommandLine="regsvr32 /s /c "$(TargetPath)""/>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
PreprocessorDefinitions="NDEBUG"
|
||||
Culture="1033"
|
||||
AdditionalIncludeDirectories="$(IntDir)"/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCWebDeploymentTool"/>
|
||||
<Tool
|
||||
Name="VCManagedWrapperGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
|
||||
</Configuration>
|
||||
</Configurations>
|
||||
<References>
|
||||
</References>
|
||||
<Files>
|
||||
<Filter
|
||||
Name="Source Files"
|
||||
Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx"
|
||||
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}">
|
||||
<File
|
||||
RelativePath=".\P3DActiveX.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\P3DActiveX.idl">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\P3DActiveXCtrl.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\P3DActiveXPropPage.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\PPBrowserObject.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\PPDownloadCallback.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\PPDownloadRequest.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\PPInstance.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\PPInterface.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\PPLogger.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\PPPandaObject.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\stdafx.cpp">
|
||||
<FileConfiguration
|
||||
Name="Debug|Win32">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
UsePrecompiledHeader="1"/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Release|Win32">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
UsePrecompiledHeader="1"/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="Header Files"
|
||||
Filter="h;hpp;hxx;hm;inl;inc;xsd"
|
||||
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}">
|
||||
<File
|
||||
RelativePath=".\P3DActiveX.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\P3DActiveXCtrl.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\P3DActiveXPropPage.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\PPBrowserObject.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\PPDownloadCallback.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\PPDownloadRequest.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\PPInstance.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\PPInterface.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\PPLogger.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\PPPandaObject.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\Resource.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\stdafx.h">
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="Resource Files"
|
||||
Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx"
|
||||
UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}">
|
||||
<File
|
||||
RelativePath=".\P3DActiveX.rc">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\P3DActiveXCtrl.bmp">
|
||||
</File>
|
||||
</Filter>
|
||||
<File
|
||||
RelativePath=".\ReadMe.txt">
|
||||
</File>
|
||||
</Files>
|
||||
<Globals>
|
||||
<Global
|
||||
Name="RESOURCE_FILE"
|
||||
Value="P3DActiveX.rc"/>
|
||||
</Globals>
|
||||
</VisualStudioProject>
|
||||
<?xml version="1.0" encoding="Windows-1252"?>
|
||||
<VisualStudioProject
|
||||
ProjectType="Visual C++"
|
||||
Version="7.10"
|
||||
Name="P3DActiveX"
|
||||
ProjectGUID="{74451B00-2D87-412B-9359-B5CA2C2FEC2A}"
|
||||
Keyword="MFCActiveXProj">
|
||||
<Platforms>
|
||||
<Platform
|
||||
Name="Win32"/>
|
||||
</Platforms>
|
||||
<Configurations>
|
||||
<Configuration
|
||||
Name="Debug|Win32"
|
||||
OutputDirectory="Debug"
|
||||
IntermediateDirectory="Debug"
|
||||
ConfigurationType="2"
|
||||
UseOfMFC="2"
|
||||
CharacterSet="2">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories="..\plugin;..\..\..\wintools\include;"..\..\..\wintools\sdk\openssl\openssl-0.9.6d\inc32""
|
||||
PreprocessorDefinitions="WIN32;_WINDOWS;_DEBUG;_USRDLL"
|
||||
MinimalRebuild="TRUE"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="2"
|
||||
TreatWChar_tAsBuiltInType="TRUE"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="3"
|
||||
Detect64BitPortabilityProblems="TRUE"
|
||||
DebugInformationFormat="3"/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="tinyxml.lib ssleay32.lib libeay32.lib"
|
||||
OutputFile="$(OutDir)/P3DActiveX.ocx"
|
||||
LinkIncremental="1"
|
||||
AdditionalLibraryDirectories=""../../../wintools/sdk/openssl/openssl-0.9.6d/out32.dbg";../../../wintools/built/lib"
|
||||
IgnoreDefaultLibraryNames="LIBCI.LIB MSVCRTD.LIB MSVCRT.LIB"
|
||||
ModuleDefinitionFile=".\P3DActiveX.def"
|
||||
GenerateDebugInformation="TRUE"
|
||||
SubSystem="2"
|
||||
ImportLibrary="$(OutDir)/P3DActiveX.lib"
|
||||
TargetMachine="1"
|
||||
FixedBaseAddress="1"/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
PreprocessorDefinitions="_DEBUG"
|
||||
MkTypLibCompatible="FALSE"
|
||||
TypeLibraryName="$(IntDir)/$(ProjectName).tlb"
|
||||
HeaderFileName="$(ProjectName)idl.h"/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
Description="Performing registration"
|
||||
CommandLine="regsvr32 /s /c "$(TargetPath)""/>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
PreprocessorDefinitions="_DEBUG"
|
||||
Culture="1033"
|
||||
AdditionalIncludeDirectories="$(IntDir)"/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCWebDeploymentTool"/>
|
||||
<Tool
|
||||
Name="VCManagedWrapperGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="Release|Win32"
|
||||
OutputDirectory="Release"
|
||||
IntermediateDirectory="Release"
|
||||
ConfigurationType="2"
|
||||
UseOfMFC="2"
|
||||
CharacterSet="2">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalIncludeDirectories="..\plugin;..\..\..\wintools\include;"..\..\..\wintools\sdk\openssl\openssl-0.9.6d\inc32""
|
||||
PreprocessorDefinitions="WIN32;_WINDOWS;NDEBUG;_USRDLL"
|
||||
RuntimeLibrary="2"
|
||||
TreatWChar_tAsBuiltInType="TRUE"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="3"
|
||||
Detect64BitPortabilityProblems="TRUE"
|
||||
DebugInformationFormat="3"/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="tinyxml.lib ssleay32.lib libeay32.lib"
|
||||
OutputFile="$(OutDir)/P3DActiveX.ocx"
|
||||
LinkIncremental="1"
|
||||
AdditionalLibraryDirectories=""../../../wintools/sdk/openssl/openssl-0.9.6d/out32";../../../wintools/built/lib"
|
||||
IgnoreDefaultLibraryNames="LIBCI.LIB MSVCRTD.LIB MSVCRT.LIB"
|
||||
ModuleDefinitionFile=".\P3DActiveX.def"
|
||||
GenerateDebugInformation="TRUE"
|
||||
SubSystem="2"
|
||||
OptimizeReferences="2"
|
||||
EnableCOMDATFolding="2"
|
||||
ImportLibrary="$(OutDir)/P3DActiveX.lib"
|
||||
TargetMachine="1"
|
||||
FixedBaseAddress="1"/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
PreprocessorDefinitions="NDEBUG"
|
||||
MkTypLibCompatible="FALSE"
|
||||
TypeLibraryName="$(IntDir)/$(ProjectName).tlb"
|
||||
HeaderFileName="$(ProjectName)idl.h"/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
Description="Performing registration"
|
||||
CommandLine="regsvr32 /s /c "$(TargetPath)""/>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
PreprocessorDefinitions="NDEBUG"
|
||||
Culture="1033"
|
||||
AdditionalIncludeDirectories="$(IntDir)"/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCWebDeploymentTool"/>
|
||||
<Tool
|
||||
Name="VCManagedWrapperGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
|
||||
</Configuration>
|
||||
</Configurations>
|
||||
<References>
|
||||
</References>
|
||||
<Files>
|
||||
<Filter
|
||||
Name="Source Files"
|
||||
Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx"
|
||||
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}">
|
||||
<File
|
||||
RelativePath="..\plugin\fileSpec.cxx">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\plugin\find_root_dir.cxx">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\plugin\load_plugin.cxx">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\plugin\mkdir_complete.cxx">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\P3DActiveX.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\P3DActiveX.idl">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\P3DActiveXCtrl.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\P3DActiveXPropPage.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\PPBrowserObject.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\PPDownloadCallback.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\PPDownloadRequest.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\PPInstance.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\PPInterface.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\PPLogger.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\PPPandaObject.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\stdafx.cpp">
|
||||
<FileConfiguration
|
||||
Name="Debug|Win32">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
UsePrecompiledHeader="1"/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Release|Win32">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
UsePrecompiledHeader="1"/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="Header Files"
|
||||
Filter="h;hpp;hxx;hm;inl;inc;xsd"
|
||||
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}">
|
||||
<File
|
||||
RelativePath=".\P3DActiveX.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\P3DActiveXCtrl.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\P3DActiveXPropPage.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\PPBrowserObject.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\PPDownloadCallback.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\PPDownloadRequest.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\PPInstance.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\PPInterface.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\PPLogger.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\PPPandaObject.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\Resource.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\stdafx.h">
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="Resource Files"
|
||||
Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx"
|
||||
UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}">
|
||||
<File
|
||||
RelativePath=".\P3DActiveX.rc">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\P3DActiveXCtrl.bmp">
|
||||
</File>
|
||||
</Filter>
|
||||
<File
|
||||
RelativePath=".\ReadMe.txt">
|
||||
</File>
|
||||
</Files>
|
||||
<Globals>
|
||||
<Global
|
||||
Name="RESOURCE_FILE"
|
||||
Value="P3DActiveX.rc"/>
|
||||
</Globals>
|
||||
</VisualStudioProject>
|
||||
|
@ -35,36 +35,15 @@
|
||||
|
||||
#include "p3d_plugin_config.h"
|
||||
#include "get_tinyxml.h"
|
||||
#include "load_plugin.h"
|
||||
#include "find_root_dir.h"
|
||||
#include "mkdir_complete.h"
|
||||
|
||||
#define P3D_CONTENTS_FILENAME "contents.xml"
|
||||
#define P3D_DEFAULT_PLUGIN_FILENAME "p3d_plugin.dll"
|
||||
|
||||
static HMODULE s_hP3DPluginDll = NULL;
|
||||
static int s_instanceCount = 0;
|
||||
|
||||
P3D_initialize_func *P3D_initialize;
|
||||
P3D_finalize_func *P3D_finalize;
|
||||
P3D_new_instance_func *P3D_new_instance;
|
||||
P3D_instance_start_func *P3D_instance_start;
|
||||
P3D_instance_finish_func *P3D_instance_finish;
|
||||
P3D_instance_setup_window_func *P3D_instance_setup_window;
|
||||
P3D_instance_get_request_func *P3D_instance_get_request;
|
||||
P3D_check_request_func *P3D_check_request;
|
||||
P3D_request_finish_func *P3D_request_finish;
|
||||
P3D_instance_feed_url_stream_func *P3D_instance_feed_url_stream;
|
||||
|
||||
P3D_instance_set_browser_script_object_func *P3D_instance_set_browser_script_object;
|
||||
P3D_instance_get_panda_script_object_func *P3D_instance_get_panda_script_object;
|
||||
P3D_make_class_definition_func *P3D_make_class_definition;
|
||||
|
||||
P3D_new_undefined_object_func *P3D_new_undefined_object;
|
||||
P3D_new_none_object_func *P3D_new_none_object;
|
||||
P3D_new_bool_object_func *P3D_new_bool_object;
|
||||
P3D_new_int_object_func *P3D_new_int_object;
|
||||
P3D_new_float_object_func *P3D_new_float_object;
|
||||
P3D_new_string_object_func *P3D_new_string_object;
|
||||
|
||||
|
||||
void P3D_NofificationSync(P3D_instance *instance)
|
||||
{
|
||||
static bool handleRequestOnUIThread = true;
|
||||
@ -92,17 +71,17 @@ void P3D_NofificationSync(P3D_instance *instance)
|
||||
PPInstance::PPInstance( CP3DActiveXCtrl& parentCtrl ) :
|
||||
m_parentCtrl( parentCtrl ), m_p3dInstance( NULL ), m_p3dObject( NULL ), m_handleRequestOnUIThread( true ), m_isInit( false )
|
||||
{
|
||||
TCHAR tempFolderName[ MAX_PATH ];
|
||||
DWORD pathLength = ::GetTempPath( MAX_PATH, tempFolderName );
|
||||
// Open the logfile first.
|
||||
m_logger.Open( );
|
||||
|
||||
m_logger.Open( std::string( tempFolderName ), std::string( P3D_DEFAULT_PLUGIN_LOG_FILENAME ) );
|
||||
m_rootDir = find_root_dir( nout );
|
||||
m_pluginLoaded = false;
|
||||
}
|
||||
|
||||
PPInstance::~PPInstance( )
|
||||
{
|
||||
if ( m_p3dInstance )
|
||||
{
|
||||
nout << this << ": Finishing P3D instance \n";
|
||||
P3D_instance_finish( m_p3dInstance );
|
||||
m_p3dInstance = NULL;
|
||||
}
|
||||
@ -111,7 +90,10 @@ PPInstance::~PPInstance( )
|
||||
P3D_OBJECT_DECREF( m_p3dObject );
|
||||
m_p3dObject = NULL;
|
||||
}
|
||||
UnloadPlugin();
|
||||
if ( m_pluginLoaded )
|
||||
{
|
||||
UnloadPlugin();
|
||||
}
|
||||
}
|
||||
|
||||
int PPInstance::DownloadFile( const std::string& from, const std::string& to )
|
||||
@ -130,7 +112,33 @@ int PPInstance::DownloadFile( const std::string& from, const std::string& to )
|
||||
return error;
|
||||
}
|
||||
|
||||
int PPInstance::ReadContents( const std::string& contentsFilename, std::string& p3dDllFilename )
|
||||
int PPInstance::CopyFile( const std::string& from, const std::string& to )
|
||||
{
|
||||
ifstream in(from.c_str(), ios::in | ios::binary);
|
||||
ofstream out(to.c_str(), ios::out | ios::binary);
|
||||
|
||||
static const size_t buffer_size = 4096;
|
||||
char buffer[buffer_size];
|
||||
|
||||
in.read(buffer, buffer_size);
|
||||
size_t count = in.gcount();
|
||||
while (count != 0) {
|
||||
out.write(buffer, count);
|
||||
if (out.fail()) {
|
||||
return 1;
|
||||
}
|
||||
in.read(buffer, buffer_size);
|
||||
count = in.gcount();
|
||||
}
|
||||
|
||||
if (!in.eof()) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int PPInstance::ReadContents( const std::string& contentsFilename, FileSpec& p3dDllFile )
|
||||
{
|
||||
int error(1);
|
||||
|
||||
@ -149,7 +157,7 @@ int PPInstance::ReadContents( const std::string& contentsFilename, std::string&
|
||||
const char *platform = xpackage->Attribute( "platform" );
|
||||
if ( platform != NULL && !strcmp(platform, "win32") )
|
||||
{
|
||||
p3dDllFilename += xpackage->Attribute( "filename" );
|
||||
p3dDllFile.load_xml(xpackage);
|
||||
error = 0;
|
||||
break;
|
||||
}
|
||||
@ -165,132 +173,117 @@ int PPInstance::DownloadP3DComponents( std::string& p3dDllFilename )
|
||||
{
|
||||
int error(0);
|
||||
|
||||
// Start off by downloading contents.xml into a local temporary
|
||||
// file. We get a unique temporary filename each time; this is a
|
||||
// small file and it's very important that we get the most current
|
||||
// version, not an old cached version.
|
||||
TCHAR tempFolderName[ MAX_PATH ];
|
||||
DWORD pathLength = ::GetTempPath( MAX_PATH, tempFolderName );
|
||||
::GetTempPath( MAX_PATH, tempFolderName );
|
||||
TCHAR tempFileName[ MAX_PATH ];
|
||||
::GetTempFileName( tempFolderName, "p3d", 0, tempFileName );
|
||||
std::string localContentsFileName( tempFileName );
|
||||
|
||||
std::string localContentsFileName( tempFolderName, pathLength );
|
||||
localContentsFileName += P3D_CONTENTS_FILENAME;
|
||||
// We'll also get the final installation path of the contents.xml
|
||||
// file.
|
||||
std::string finalContentsFileName( m_rootDir );
|
||||
finalContentsFileName += "/";
|
||||
finalContentsFileName += P3D_CONTENTS_FILENAME;
|
||||
|
||||
std::string hostUrl( PANDA_PACKAGE_HOST_URL );
|
||||
if (!hostUrl.empty() && hostUrl[hostUrl.size() - 1] != '/') {
|
||||
hostUrl += '/';
|
||||
}
|
||||
|
||||
std::string remoteContentsFilename( hostUrl );
|
||||
remoteContentsFilename += P3D_CONTENTS_FILENAME;
|
||||
// Append a query string to the contents.xml URL to uniquify it
|
||||
// and ensure we don't get a cached version.
|
||||
std::ostringstream strm;
|
||||
strm << hostUrl << P3D_CONTENTS_FILENAME << "?" << time(NULL);
|
||||
std::string remoteContentsUrl( strm.str() );
|
||||
|
||||
error = DownloadFile( remoteContentsFilename, localContentsFileName );
|
||||
FileSpec p3dDllFile;
|
||||
error = DownloadFile( remoteContentsUrl, localContentsFileName );
|
||||
if ( !error )
|
||||
{
|
||||
std::string p3dRemoteModuleFileName( hostUrl );
|
||||
error = ReadContents( localContentsFileName, p3dRemoteModuleFileName );
|
||||
if ( !error )
|
||||
{
|
||||
std::string p3dLocalModuleFileName( tempFolderName, pathLength );
|
||||
p3dLocalModuleFileName += P3D_DEFAULT_PLUGIN_FILENAME;
|
||||
error = ReadContents( localContentsFileName, p3dDllFile );
|
||||
}
|
||||
|
||||
// Check for existance
|
||||
if ( ::GetFileAttributes( p3dLocalModuleFileName.c_str( ) ) == INVALID_FILE_ATTRIBUTES )
|
||||
{
|
||||
error = DownloadFile( p3dRemoteModuleFileName, p3dLocalModuleFileName );
|
||||
}
|
||||
if ( error ) {
|
||||
// If we couldn't download or read the contents.xml file, check
|
||||
// to see if there's a good one on disk already, as a fallback.
|
||||
error = ReadContents( finalContentsFileName, p3dDllFile );
|
||||
|
||||
} else {
|
||||
// If we have successfully read the downloaded version,
|
||||
// then move the downloaded version into the final location.
|
||||
mkfile_complete( finalContentsFileName, nout );
|
||||
CopyFile( localContentsFileName, finalContentsFileName );
|
||||
}
|
||||
|
||||
// We don't need the temporary file any more.
|
||||
::DeleteFile( localContentsFileName.c_str() );
|
||||
|
||||
if ( !error )
|
||||
{
|
||||
// OK, at this point we have successfully read contents.xml,
|
||||
// and we have a good file spec in p3dDllFile.
|
||||
if ( p3dDllFile.quick_verify( m_rootDir ) )
|
||||
{
|
||||
// The DLL is already on-disk, and is good.
|
||||
p3dDllFilename = p3dDllFile.get_pathname( m_rootDir );
|
||||
}
|
||||
else
|
||||
{
|
||||
// The DLL is not already on-disk, or it's stale.
|
||||
std::string p3dLocalModuleFileName( p3dDllFile.get_pathname( m_rootDir ) );
|
||||
mkfile_complete( p3dLocalModuleFileName, nout );
|
||||
std::string p3dRemoteModuleUrl( hostUrl );
|
||||
p3dRemoteModuleUrl += p3dDllFile.get_filename();
|
||||
error = DownloadFile( p3dRemoteModuleUrl, p3dLocalModuleFileName );
|
||||
if ( !error )
|
||||
{
|
||||
p3dDllFilename = p3dLocalModuleFileName;
|
||||
error = 1;
|
||||
if ( p3dDllFile.full_verify( m_rootDir ) )
|
||||
{
|
||||
// Downloaded successfully.
|
||||
p3dDllFilename = p3dDllFile.get_pathname( m_rootDir );
|
||||
error = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return error;
|
||||
}
|
||||
|
||||
int PPInstance::LoadPlugin( const std::string& dllFilename )
|
||||
{
|
||||
s_instanceCount += 1;
|
||||
int error(0);
|
||||
if ( !s_hP3DPluginDll )
|
||||
{
|
||||
std::string filename( dllFilename );
|
||||
if ( !m_pluginLoaded )
|
||||
{
|
||||
s_instanceCount += 1;
|
||||
m_pluginLoaded = true;
|
||||
}
|
||||
|
||||
if ( filename.empty() )
|
||||
{
|
||||
// Look for the plugin along the path.
|
||||
filename = P3D_DEFAULT_PLUGIN_FILENAME;
|
||||
filename += ".dll";
|
||||
}
|
||||
int error = 0;
|
||||
if (!is_plugin_loaded()) {
|
||||
|
||||
nout << "Loading " << filename << "\n";
|
||||
s_hP3DPluginDll = LoadLibrary( filename.c_str() );
|
||||
nout << "got " << s_hP3DPluginDll << "\n";
|
||||
if ( s_hP3DPluginDll == NULL )
|
||||
{
|
||||
// Couldn't load the DLL.
|
||||
nout << "Error loading " << filename << " :" << GetLastError() << "\n";
|
||||
return false;
|
||||
}
|
||||
|
||||
char buffer[MAX_PATH];
|
||||
if ( GetModuleFileName( s_hP3DPluginDll, buffer, MAX_PATH ) != 0 )
|
||||
{
|
||||
if ( GetLastError() != 0 )
|
||||
{
|
||||
filename = buffer;
|
||||
}
|
||||
}
|
||||
|
||||
// Now get all of the function pointers.
|
||||
P3D_initialize = (P3D_initialize_func *)GetProcAddress(s_hP3DPluginDll, "P3D_initialize");
|
||||
P3D_finalize = (P3D_finalize_func *)GetProcAddress(s_hP3DPluginDll, "P3D_finalize");
|
||||
P3D_new_instance = (P3D_new_instance_func *)GetProcAddress(s_hP3DPluginDll, "P3D_new_instance");
|
||||
P3D_instance_start = (P3D_instance_start_func *)GetProcAddress(s_hP3DPluginDll, "P3D_instance_start");
|
||||
P3D_instance_finish = (P3D_instance_finish_func *)GetProcAddress(s_hP3DPluginDll, "P3D_instance_finish");
|
||||
P3D_instance_setup_window = (P3D_instance_setup_window_func *)GetProcAddress(s_hP3DPluginDll, "P3D_instance_setup_window");
|
||||
P3D_instance_get_request = (P3D_instance_get_request_func *)GetProcAddress(s_hP3DPluginDll, "P3D_instance_get_request");
|
||||
P3D_check_request = (P3D_check_request_func *)GetProcAddress(s_hP3DPluginDll, "P3D_check_request");
|
||||
P3D_request_finish = (P3D_request_finish_func *)GetProcAddress(s_hP3DPluginDll, "P3D_request_finish");
|
||||
P3D_instance_feed_url_stream = (P3D_instance_feed_url_stream_func *)GetProcAddress(s_hP3DPluginDll, "P3D_instance_feed_url_stream");
|
||||
|
||||
P3D_instance_set_browser_script_object = (P3D_instance_set_browser_script_object_func *)GetProcAddress(s_hP3DPluginDll, "P3D_instance_set_browser_script_object");
|
||||
P3D_instance_get_panda_script_object = (P3D_instance_get_panda_script_object_func *)GetProcAddress(s_hP3DPluginDll, "P3D_instance_get_panda_script_object");
|
||||
P3D_make_class_definition = (P3D_make_class_definition_func *)GetProcAddress(s_hP3DPluginDll, "P3D_make_class_definition");
|
||||
|
||||
P3D_new_undefined_object = (P3D_new_undefined_object_func *)GetProcAddress(s_hP3DPluginDll, "P3D_new_undefined_object");
|
||||
P3D_new_none_object = (P3D_new_none_object_func *)GetProcAddress(s_hP3DPluginDll, "P3D_new_none_object");
|
||||
P3D_new_bool_object = (P3D_new_bool_object_func *)GetProcAddress(s_hP3DPluginDll, "P3D_new_bool_object");
|
||||
P3D_new_int_object = (P3D_new_int_object_func *)GetProcAddress(s_hP3DPluginDll, "P3D_new_int_object");
|
||||
P3D_new_float_object = (P3D_new_float_object_func *)GetProcAddress(s_hP3DPluginDll, "P3D_new_float_object");
|
||||
P3D_new_string_object = (P3D_new_string_object_func *)GetProcAddress(s_hP3DPluginDll, "P3D_new_string_object");
|
||||
|
||||
// Ensure that all of the function pointers have been found.
|
||||
if (P3D_initialize == NULL ||
|
||||
P3D_finalize == NULL ||
|
||||
P3D_new_instance == NULL ||
|
||||
P3D_instance_finish == NULL ||
|
||||
P3D_instance_get_request == NULL ||
|
||||
P3D_check_request == NULL ||
|
||||
P3D_request_finish == NULL ||
|
||||
P3D_instance_get_panda_script_object == NULL ||
|
||||
P3D_instance_set_browser_script_object == NULL ||
|
||||
P3D_instance_feed_url_stream == NULL ||
|
||||
P3D_make_class_definition == NULL ||
|
||||
P3D_new_none_object == NULL ||
|
||||
P3D_new_bool_object == NULL ||
|
||||
P3D_new_int_object == NULL ||
|
||||
P3D_new_float_object == NULL ||
|
||||
P3D_new_string_object == NULL )
|
||||
{
|
||||
return ( error = 1 );
|
||||
}
|
||||
|
||||
// Successfully loaded.
|
||||
nout << "Initializing P3D P3D_API_VERSION=" << P3D_API_VERSION << "\n";
|
||||
if ( !P3D_initialize( P3D_API_VERSION, "", "", true, "", "", "", false ) )
|
||||
{
|
||||
// Oops, failure to initialize.
|
||||
nout << "Error initializing P3D: " << GetLastError() << "\n";
|
||||
::FreeLibrary( s_hP3DPluginDll );
|
||||
s_hP3DPluginDll = NULL;
|
||||
return ( error = 1 );
|
||||
}
|
||||
std::string pathname = dllFilename;
|
||||
#ifdef P3D_PLUGIN_P3D_PLUGIN
|
||||
// This is a convenience macro for development. If defined and
|
||||
// nonempty, it indicates the name of the plugin DLL that we will
|
||||
// actually run, even after downloading a possibly different
|
||||
// (presumably older) version. Its purpose is to simplify iteration
|
||||
// on the plugin DLL.
|
||||
string override_filename = P3D_PLUGIN_P3D_PLUGIN;
|
||||
if (!override_filename.empty()) {
|
||||
pathname = override_filename;
|
||||
}
|
||||
#endif // P3D_PLUGIN_P3D_PLUGIN
|
||||
|
||||
nout << "Attempting to load core API from " << pathname << "\n";
|
||||
if (!load_plugin(pathname, "", "", true, "", "", "", false, nout)) {
|
||||
nout << "Unable to launch core API in " << pathname << "\n";
|
||||
error = 1;
|
||||
}
|
||||
}
|
||||
|
||||
return error ;
|
||||
@ -299,29 +292,22 @@ int PPInstance::LoadPlugin( const std::string& dllFilename )
|
||||
int PPInstance::UnloadPlugin()
|
||||
{
|
||||
int error( 0 );
|
||||
assert( s_instanceCount > 0 );
|
||||
s_instanceCount -= 1;
|
||||
|
||||
if ( s_instanceCount == 0 && s_hP3DPluginDll != NULL )
|
||||
{
|
||||
nout << "Finalizing P3D\n";
|
||||
P3D_finalize();
|
||||
m_isInit = false;
|
||||
if ( m_pluginLoaded )
|
||||
{
|
||||
m_pluginLoaded = false;
|
||||
assert( s_instanceCount > 0 );
|
||||
s_instanceCount -= 1;
|
||||
|
||||
nout << "Unloading P3D dll " << s_hP3DPluginDll << "\n";
|
||||
if ( !::FreeLibrary( s_hP3DPluginDll ) )
|
||||
if ( s_instanceCount == 0 && is_plugin_loaded() )
|
||||
{
|
||||
nout << "Error unloading P3D dll :" << GetLastError << "\n";
|
||||
error = 1;
|
||||
unload_plugin();
|
||||
m_isInit = false;
|
||||
|
||||
// This pointer is no longer valid and must be reset for next
|
||||
// time.
|
||||
PPBrowserObject::clear_class_definition();
|
||||
}
|
||||
else
|
||||
{
|
||||
s_hP3DPluginDll = NULL;
|
||||
}
|
||||
|
||||
// This pointer is no longer valid and must be reset for next
|
||||
// time.
|
||||
PPBrowserObject::clear_class_definition();
|
||||
}
|
||||
return error;
|
||||
}
|
||||
|
@ -21,6 +21,7 @@
|
||||
#include "p3d_plugin.h"
|
||||
#include "PPDownloadCallback.h"
|
||||
#include "PPLogger.h"
|
||||
#include "fileSpec.h"
|
||||
|
||||
#define WM_PY_LAUNCHED (WM_USER + 1)
|
||||
#define WM_PROGRESS (WM_USER + 2)
|
||||
@ -67,7 +68,8 @@ protected:
|
||||
PPInstance( const PPInstance& );
|
||||
|
||||
int DownloadFile( const std::string& from, const std::string& to );
|
||||
int ReadContents( const std::string& contentsFilename, std::string& p3dDllFilename );
|
||||
int CopyFile( const std::string& from, const std::string& to );
|
||||
int ReadContents( const std::string& contentsFilename, FileSpec& p3dDllFile );
|
||||
|
||||
void HandleRequest( P3D_request *request );
|
||||
static void HandleRequestGetUrl( void *data );
|
||||
@ -78,4 +80,7 @@ protected:
|
||||
|
||||
bool m_handleRequestOnUIThread;
|
||||
bool m_isInit;
|
||||
bool m_pluginLoaded;
|
||||
|
||||
std::string m_rootDir;
|
||||
};
|
||||
|
@ -89,45 +89,50 @@ int PPLogger::CreateNewFile(const std::string& dirname, const std::string& filen
|
||||
return error;
|
||||
}
|
||||
|
||||
void PPLogger::Open( const std::string& logdir, const std::string& filename )
|
||||
void PPLogger::Open( )
|
||||
{
|
||||
if ( !m_isOpen )
|
||||
{
|
||||
int error = CreateNewFile( logdir, filename );
|
||||
// Note that this logfile name may not be specified at runtime. It
|
||||
// must be compiled in if it is specified at all.
|
||||
if (!m_isOpen) {
|
||||
// Note that this logfile name may not be specified at runtime. It
|
||||
// must be compiled in if it is specified at all.
|
||||
|
||||
std::string logBasename = filename;
|
||||
|
||||
#ifdef P3D_DEFAULT_PLUGIN_LOG_FILENAME
|
||||
if ( logBasename.empty( ) )
|
||||
{
|
||||
logBasename = P3D_DEFAULT_PLUGIN_LOG_FILENAME;
|
||||
}
|
||||
std::string log_basename;
|
||||
#ifdef P3D_PLUGIN_LOG_BASENAME1
|
||||
log_basename = P3D_PLUGIN_LOG_BASENAME1;
|
||||
#endif
|
||||
if ( !logBasename.empty( ) )
|
||||
{
|
||||
// Get the log directory.
|
||||
std::string logDirectory = logdir;
|
||||
if ( logDirectory.empty( ) )
|
||||
{
|
||||
char buffer[MAX_PATH];
|
||||
if ( GetTempPath( MAX_PATH, buffer ) != 0 )
|
||||
{
|
||||
logDirectory = buffer;
|
||||
}
|
||||
}
|
||||
// Construct the full logfile pathname.
|
||||
std::string logPathname = logDirectory;
|
||||
logPathname += logBasename;
|
||||
|
||||
m_logfile.open( logPathname.c_str( ) );
|
||||
m_logfile.setf( std::ios::unitbuf );
|
||||
if (!log_basename.empty()) {
|
||||
// Get the log directory.
|
||||
std::string log_directory;
|
||||
#ifdef P3D_PLUGIN_LOG_DIRECTORY
|
||||
log_directory = P3D_PLUGIN_LOG_DIRECTORY;
|
||||
#endif
|
||||
if (log_directory.empty()) {
|
||||
static const size_t buffer_size = MAX_PATH;
|
||||
char buffer[buffer_size];
|
||||
if (GetTempPath(buffer_size, buffer) != 0) {
|
||||
log_directory = buffer;
|
||||
}
|
||||
}
|
||||
|
||||
// If we didn't have a logfile name compiled in, we throw away log
|
||||
// output by the simple expedient of never actually opening the
|
||||
// ofstream.
|
||||
m_isOpen = true;
|
||||
// Ensure that the log directory ends with a slash.
|
||||
if (!log_directory.empty() && log_directory[log_directory.size() - 1] != '/') {
|
||||
if (log_directory[log_directory.size() - 1] != '\\')
|
||||
log_directory += "/";
|
||||
}
|
||||
|
||||
// Construct the full logfile pathname.
|
||||
std::string log_pathname = log_directory;
|
||||
log_pathname += log_basename;
|
||||
log_pathname += ".log";
|
||||
|
||||
m_logfile.clear();
|
||||
m_logfile.open(log_pathname.c_str());
|
||||
m_logfile.setf(std::ios::unitbuf);
|
||||
}
|
||||
|
||||
// If we didn't have a logfile name compiled in, we throw away log
|
||||
// output by the simple expedient of never actually opening the
|
||||
// ofstream.
|
||||
m_isOpen = true;
|
||||
}
|
||||
}
|
||||
|
@ -26,7 +26,7 @@ public:
|
||||
PPLogger( );
|
||||
virtual ~PPLogger( );
|
||||
|
||||
void Open( const std::string& logdir, const std::string& logbasename );
|
||||
void Open( );
|
||||
static std::ofstream& Log( ) { return m_logfile; }
|
||||
|
||||
protected:
|
||||
|
Loading…
x
Reference in New Issue
Block a user