THammami01 / ulms

University Library Management System
MIT License
5 stars 1 forks source link

Add support for non-Windows platforms #1

Open THammami01 opened 1 year ago

THammami01 commented 1 year ago

It works well on Windows, however, the command that initializes the app's directories have to be altered in order to run on other operating systems.

Refer to these lines in main.Main:

    // ...

    public static final String appDir = "C:\\UVT-HICS\\ULMS\\";
    public static final String backupsDir = "C:\\UVT-HICS\\ULMS\\BackUps\\";

    // ...

    public static void initDirs() {
        try {
            String command = String.format("mkdir %s", backupsDir);
            Runtime.getRuntime().exec("cmd /c " + command);
        } catch (Exception e) {
            e.printStackTrace();
            e.getCause();
        }
    }

    // ...
Sandeep-source commented 1 year ago

Hey @THammami01 ,

You directly run mkdir dir_name command without cmd /c and it will work on almost all platforms.

Instead of using this:

Runtime.getRuntime().exec("cmd /c " + command);

Use this:

Runtime.getRuntime().exec(command);
THammami01 commented 1 year ago

That's great, @Sandeep-source. I know it's so basic, but I wanted someone to fix it. You can make the necessary changes and then create a PR. 🥳