Mac Forums

Mac Forums (http://www.mac-forums.com/forums/)
-   Internet, Networking, and Wireless (http://www.mac-forums.com/forums/internet-networking-wireless/)
-   -   File editing via shared folder, bug? (http://www.mac-forums.com/forums/internet-networking-wireless/264030-file-editing-via-shared-folder-bug.html)

gatzkerob 01-18-2012 04:01 PM

File editing via shared folder, bug?
 
I have file sharing enabled from Mac to PC. When I edit a file on the PC (from the Mac's shared folder), and then save the file, the text is messed up on the Mac. This doesn't happen when I move a file to Mac via USB.

FOR EXAMPLE:
I create a file "abc.txt" on Mac. It contains the following text:

abc
123
asd
456

I then put it in the shared folder.

I then go to the PC and open it (via shared folder). I remove "asd" so it looks like this:

abc
123
456

I save it and go back to Mac.

On Mac, it looks like this:

abc
123
456
456

So not only does Mac remove "asd", it also repeats the last line.

I'm stumped..

IvanLasston 01-18-2012 04:09 PM

What are you using to edit the file on either the Mac or the PC? When it comes to text DOS type programs put a cr/lf at the end of line - whereas *NIX does something different.
How to Transfer Text Files Between Linux, Macintosh, Microsoft Windows Operating Systems
Vim is available across platforms and handles various text files well.

There is also a command called dos2unix that helps fix these kinds of issues. You can get it from macports or fink - I don't think it comes by default on the Mac because my install is in /opt/local/bin - which usually means a macport install.
The MacPorts Project -- Home

vansmith 01-18-2012 04:19 PM

Quote:

Originally Posted by IvanLasston (Post 1357472)
What are you using to edit the file on either the Mac or the PC? When it comes to text DOS type programs put a cr/lf at the end of line - whereas *NIX does something different.

I know the operating systems represent line and carriage returns differently but would this cause the last line to repeat?

gatzkerob 01-18-2012 04:27 PM

Quote:

Originally Posted by IvanLasston (Post 1357472)
What are you using to edit the file on either the Mac or the PC? When it comes to text DOS type programs put a cr/lf at the end of line - whereas *NIX does something different.
How to Transfer Text Files Between Linux, Macintosh, Microsoft Windows Operating Systems
Vim is available across platforms and handles various text files well.

There is also a command called dos2unix that helps fix these kinds of issues. You can get it from macports or fink - I don't think it comes by default on the Mac because my install is in /opt/local/bin - which usually means a macport install.
The MacPorts Project -- Home

I'm using Notepad++ on PC and Xcode / TextEdit / TextWrangler on Mac; all three of which produce the same bug.

Thanks for your feedback, I'll work on it and post my results afterwards.

One thing to note is this also happens over multiple lines. I deleted a large chunk of HTML from another file. It deleted the same chunk on Mac, but it also replicated the same number of lines from the bottom of the code and then added those lines to the bottom of the code.


All times are GMT -4. The time now is 03:02 PM.

Powered by vBulletin
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.