macOS drops us into "/" when opening the app bundle without a file. use $HOME instead.

This commit is contained in:
Axel Kohlmeyer
2023-09-01 03:29:45 -04:00
parent 2e0bc524cc
commit 0043e4ccc8
2 changed files with 3 additions and 1 deletions

View File

@ -1,6 +1,6 @@
cmake_minimum_required(VERSION 3.16)
project(lammps-gui VERSION 1.5.0 LANGUAGES CXX)
project(lammps-gui VERSION 1.5.1 LANGUAGES CXX)
set(CMAKE_AUTOUIC ON)
set(CMAKE_AUTOMOC ON)

View File

@ -113,6 +113,8 @@ LammpsGui::LammpsGui(QWidget *parent, const char *filename) :
capturer = new StdCapture;
current_file.clear();
current_dir = QDir(".").absolutePath();
// use $HOME if we get dropped to "/" like on macOS
if (current_dir == "/") current_dir = QDir::homePath();
QCoreApplication::setOrganizationName("The LAMMPS Developers");
QCoreApplication::setOrganizationDomain("lammps.org");