mirror of
https://github.com/aseprite/aseprite.git
synced 2024-10-04 05:50:15 +00:00
Save "ver" file in the session directory to know which Aseprite version was used
This commit is contained in:
parent
21a57ff793
commit
2ee6df8038
@ -104,19 +104,26 @@ void Session::create(base::pid pid)
|
|||||||
m_pid = pid;
|
m_pid = pid;
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
std::ofstream of(base::from_utf8(pidFilename()));
|
std::ofstream pidf(base::from_utf8(pidFilename()));
|
||||||
|
std::ofstream verf(base::from_utf8(verFilename()));
|
||||||
#else
|
#else
|
||||||
std::ofstream of(pidFilename());
|
std::ofstream pidf(pidFilename());
|
||||||
|
std::ofstream verf(verFilename());
|
||||||
#endif
|
#endif
|
||||||
of << m_pid;
|
|
||||||
|
pidf << m_pid;
|
||||||
|
verf << VERSION;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Session::removeFromDisk()
|
void Session::removeFromDisk()
|
||||||
{
|
{
|
||||||
if (base::is_file(pidFilename()))
|
|
||||||
base::delete_file(pidFilename());
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
if (base::is_file(pidFilename()))
|
||||||
|
base::delete_file(pidFilename());
|
||||||
|
|
||||||
|
if (base::is_file(verFilename()))
|
||||||
|
base::delete_file(verFilename());
|
||||||
|
|
||||||
base::remove_directory(m_path);
|
base::remove_directory(m_path);
|
||||||
}
|
}
|
||||||
catch (const std::exception& ex) {
|
catch (const std::exception& ex) {
|
||||||
@ -204,6 +211,11 @@ std::string Session::pidFilename() const
|
|||||||
return base::join_path(m_path, "pid");
|
return base::join_path(m_path, "pid");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::string Session::verFilename() const
|
||||||
|
{
|
||||||
|
return base::join_path(m_path, "ver");
|
||||||
|
}
|
||||||
|
|
||||||
void Session::deleteDirectory(const std::string& dir)
|
void Session::deleteDirectory(const std::string& dir)
|
||||||
{
|
{
|
||||||
ASSERT(!dir.empty());
|
ASSERT(!dir.empty());
|
||||||
|
@ -57,6 +57,7 @@ namespace crash {
|
|||||||
private:
|
private:
|
||||||
void loadPid();
|
void loadPid();
|
||||||
std::string pidFilename() const;
|
std::string pidFilename() const;
|
||||||
|
std::string verFilename() const;
|
||||||
void deleteDirectory(const std::string& dir);
|
void deleteDirectory(const std::string& dir);
|
||||||
|
|
||||||
base::pid m_pid;
|
base::pid m_pid;
|
||||||
|
Loading…
Reference in New Issue
Block a user