mirror of
https://github.com/aseprite/aseprite.git
synced 2025-02-24 12:41:08 +00:00
Create crash dump in aseprite folder when it's running in portable mode
This commit is contained in:
parent
25ee4df7fb
commit
6559eab214
@ -146,6 +146,8 @@ App::App(int argc, const char* argv[])
|
|||||||
|
|
||||||
// Load RenderEngine configuration
|
// Load RenderEngine configuration
|
||||||
RenderEngine::loadConfig();
|
RenderEngine::loadConfig();
|
||||||
|
if (isPortable())
|
||||||
|
PRINTF("Running in portable mode\n");
|
||||||
|
|
||||||
// Default palette.
|
// Default palette.
|
||||||
std::string palFile(!options.paletteFileName().empty() ?
|
std::string palFile(!options.paletteFileName().empty() ?
|
||||||
@ -339,6 +341,14 @@ App::~App()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool App::isPortable()
|
||||||
|
{
|
||||||
|
std::string ini_file = get_config_file();
|
||||||
|
app::ResourceFinder rf;
|
||||||
|
rf.includeBinDir("aseprite.ini");
|
||||||
|
return (ini_file == rf.defaultFilename());
|
||||||
|
}
|
||||||
|
|
||||||
tools::ToolBox* App::getToolBox() const
|
tools::ToolBox* App::getToolBox() const
|
||||||
{
|
{
|
||||||
ASSERT(m_modules != NULL);
|
ASSERT(m_modules != NULL);
|
||||||
|
@ -65,6 +65,9 @@ namespace app {
|
|||||||
// Returns true if Aseprite is running with GUI available.
|
// Returns true if Aseprite is running with GUI available.
|
||||||
bool isGui() const { return m_isGui; }
|
bool isGui() const { return m_isGui; }
|
||||||
|
|
||||||
|
// Returns true if the application is running in portable mode.
|
||||||
|
bool isPortable();
|
||||||
|
|
||||||
// Runs the Aseprite application. In GUI mode it's the top-level
|
// Runs the Aseprite application. In GUI mode it's the top-level
|
||||||
// window, in console/scripting it just runs the specified scripts.
|
// window, in console/scripting it just runs the specified scripts.
|
||||||
int run();
|
int run();
|
||||||
|
@ -32,14 +32,29 @@
|
|||||||
|
|
||||||
namespace app {
|
namespace app {
|
||||||
|
|
||||||
const char* SendCrash::kDefaultCrashName = "Aseprite-crash.dmp";
|
static const char* kDefaultCrashName = "Aseprite-crash.dmp";
|
||||||
|
|
||||||
|
std::string memory_dump_filename()
|
||||||
|
{
|
||||||
|
#ifdef WIN32
|
||||||
|
|
||||||
|
app::ResourceFinder rf;
|
||||||
|
if (App::instance()->isPortable())
|
||||||
|
rf.includeBinDir(kDefaultCrashName);
|
||||||
|
else
|
||||||
|
rf.includeHomeDir(kDefaultCrashName);
|
||||||
|
|
||||||
|
return rf.defaultFilename();
|
||||||
|
|
||||||
|
#else
|
||||||
|
return "";
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
void SendCrash::search()
|
void SendCrash::search()
|
||||||
{
|
{
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
app::ResourceFinder rf;
|
m_dumpFilename = memory_dump_filename();
|
||||||
rf.includeHomeDir(kDefaultCrashName);
|
|
||||||
m_dumpFilename = rf.defaultFilename();
|
|
||||||
|
|
||||||
if (base::is_file(m_dumpFilename)) {
|
if (base::is_file(m_dumpFilename)) {
|
||||||
App::instance()->showNotification(this);
|
App::instance()->showNotification(this);
|
||||||
|
@ -28,8 +28,6 @@ namespace app {
|
|||||||
|
|
||||||
class SendCrash : public INotificationDelegate {
|
class SendCrash : public INotificationDelegate {
|
||||||
public:
|
public:
|
||||||
static const char* kDefaultCrashName;
|
|
||||||
|
|
||||||
void search();
|
void search();
|
||||||
|
|
||||||
virtual std::string notificationText() override;
|
virtual std::string notificationText() override;
|
||||||
@ -41,6 +39,8 @@ namespace app {
|
|||||||
std::string m_dumpFilename;
|
std::string m_dumpFilename;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
std::string memory_dump_filename();
|
||||||
|
|
||||||
} // namespace app
|
} // namespace app
|
||||||
|
|
||||||
#endif // APP_SEND_CRASH_H_INCLUDED
|
#endif // APP_SEND_CRASH_H_INCLUDED
|
||||||
|
@ -53,17 +53,6 @@ namespace {
|
|||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
bool getMemoryDumpFilename(std::string& filename) {
|
|
||||||
#ifdef WIN32
|
|
||||||
app::ResourceFinder rf;
|
|
||||||
rf.includeHomeDir(app::SendCrash::kDefaultCrashName);
|
|
||||||
filename = rf.defaultFilename();
|
|
||||||
return true;
|
|
||||||
#else
|
|
||||||
return false;
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Aseprite entry point. (Called from she library.)
|
// Aseprite entry point. (Called from she library.)
|
||||||
@ -85,8 +74,8 @@ int app_main(int argc, char* argv[])
|
|||||||
|
|
||||||
// Change the name of the memory dump file
|
// Change the name of the memory dump file
|
||||||
{
|
{
|
||||||
std::string filename;
|
std::string filename = app::memory_dump_filename();
|
||||||
if (getMemoryDumpFilename(filename))
|
if (!filename.empty())
|
||||||
memoryDump.setFileName(filename);
|
memoryDump.setFileName(filename);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user