fixed a few minor bugs: handle the directory parameter to Create() correctly, better error checking
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@15153 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -158,8 +158,7 @@ LockResult wxSingleInstanceCheckerImpl::CreateLockFile()
|
|||||||
if ( m_fdLock != -1 )
|
if ( m_fdLock != -1 )
|
||||||
{
|
{
|
||||||
// try to lock it
|
// try to lock it
|
||||||
int rc = wxLockFile(m_fdLock, LOCK);
|
if ( wxLockFile(m_fdLock, LOCK) == 0 )
|
||||||
if ( rc == 0 )
|
|
||||||
{
|
{
|
||||||
// fine, we have the exclusive lock to the file, write our PID
|
// fine, we have the exclusive lock to the file, write our PID
|
||||||
// into it
|
// into it
|
||||||
@@ -188,7 +187,7 @@ LockResult wxSingleInstanceCheckerImpl::CreateLockFile()
|
|||||||
close(m_fdLock);
|
close(m_fdLock);
|
||||||
m_fdLock = -1;
|
m_fdLock = -1;
|
||||||
|
|
||||||
if ( rc != EACCES && rc != EAGAIN )
|
if ( errno != EACCES && errno != EAGAIN )
|
||||||
{
|
{
|
||||||
wxLogSysError(_("Failed to lock the lock file '%s'"),
|
wxLogSysError(_("Failed to lock the lock file '%s'"),
|
||||||
m_nameLock.c_str());
|
m_nameLock.c_str());
|
||||||
@@ -332,7 +331,12 @@ bool wxSingleInstanceChecker::Create(const wxString& name,
|
|||||||
wxString fullname = path;
|
wxString fullname = path;
|
||||||
if ( fullname.empty() )
|
if ( fullname.empty() )
|
||||||
{
|
{
|
||||||
fullname << wxGetHomeDir() << _T('/');
|
fullname = wxGetHomeDir();
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( fullname.Last() != _T('/') )
|
||||||
|
{
|
||||||
|
fullname += _T('/');
|
||||||
}
|
}
|
||||||
|
|
||||||
fullname << name;
|
fullname << name;
|
||||||
|
Reference in New Issue
Block a user