public void saveTileSet() {
        if (canvas.getMap().getTileSet().getPath() == null) {
            int returnVal = chooser.showSaveDialog(canvas);

            if (returnVal == JFileChooser.APPROVE_OPTION) {
                File file = chooser.getSelectedFile();
                File imagesDir = new File(file.getParent() + File.separator + "images");

                imagesDir.mkdir();
                copyImagesToImageDir(canvas.getMap().getTileSet().getTiles(), imagesDir);
                try {
                    fmanager.saveTileSet(file, canvas.getMap().getTileSet());
                } catch (Exception e) {
                    JOptionPane.showMessageDialog(mainUserInterface.mainFrame, "Saving tileset failed: " + e.getMessage());
                }
            }
        } else {
            File file = new File(canvas.getMap().getTileSet().getPath());
            try {
                fmanager.saveTileSet(file, canvas.getMap().getTileSet());

                File imagesDir = new File(file.getParent() + File.separator + "images");

                imagesDir.mkdir();
                copyImagesToImageDir(canvas.getMap().getTileSet().getTiles(), imagesDir);

            } catch (Exception e) {
                JOptionPane.showMessageDialog(mainUserInterface.mainFrame, "Saving tileSet failed: " + e.getMessage());
            }
        }
    }