Fix detection of lack of file extension
parent
16310c37d6
commit
1e817ee042
|
@ -154,11 +154,6 @@ add_image_format("image/bmp;bpp=8", "256 Color Bitmap (*.bmp;*.dib)");
|
|||
add_image_format("image/bmp;bpp=24", "24-bit Bitmap (*.bmp;*.dib)");
|
||||
// add_image_format("image/bmp;bpp=32", "32-bit Bitmap (*.bmp;*.dib)");
|
||||
|
||||
const get_file_extension = filePathOrName => {
|
||||
const splitByDots = filePathOrName.split(/\./g);
|
||||
return splitByDots[splitByDots.length - 1].toLowerCase();
|
||||
};
|
||||
|
||||
const palette_formats = [];
|
||||
for (const [format_id, format] of Object.entries(AnyPalette.formats)) {
|
||||
if (format.write) {
|
||||
|
|
|
@ -68,8 +68,7 @@ const get_image_format_from_extension = (file_path_or_name_or_ext)=> {
|
|||
};
|
||||
|
||||
window.save_to_file_path = (canvas, filePath, savedCallback) => {
|
||||
|
||||
const extension = get_file_extension(filePath);
|
||||
const extension = (filePath.indexOf(/\./) > -1) && filePath.split(/\./g).pop().toLowerCase();
|
||||
if (!extension) {
|
||||
// @TODO: Linux/Unix?? you're not supposed to need file extensions
|
||||
return show_error_message("Missing file extension - Try adding .png to the end of the file name");
|
||||
|
|
Loading…
Reference in New Issue