Bruenor41 - 2023-03-09

Oh, seems I can't modify my ticket... So, sorry for bad layout, I will post it here. Without this fix is target file truncated, result is empty file

        if (DOS_OpenFile(nameSource,0,&sourceHandle)) {
            // Create Target or open it if in concat mode
            strcpy(nameTarget,pathTarget);
            if (nameTarget[strlen(nameTarget)-1]=='\\') strcat(nameTarget,name);

            //Special variable to ensure that copy * a_file, where a_file is not a directory concats.
            bool special = second_file_of_current_source && target_is_file;
            second_file_of_current_source = true; 
            if (special) oldsource.concat = true;

            //FIX
            if (!oldsource.concat && (!strcasecmp(nameSource, nameTarget))) {
                WriteOut("File cannot be copied onto itself\r\n");
                dos.dta(save_dta);
                DOS_CloseFile(sourceHandle);
                if (targetHandle)
                    DOS_CloseFile(targetHandle);
                return;
            }

            //Don't create a new file when in concat mode
            if (oldsource.concat || DOS_CreateFile(nameTarget,0,&targetHandle)) {
 

Last edit: Bruenor41 2023-03-09