File "save as" doesn't work as expected

Go To Last Post
9 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I am running Studio 7 on a W10 system. I recently was editing a source file on a mega169 project. I decided that I should save the edited file with a new file name, and replace the existing file in the project with the new one. So, I selects "save as" from the menu, and I got an error message, "The operation could not be completed. Unspecified error" no error number, no other explanation. However, when I looked in the folder where I keep my source files, I could see that the new file was in there. I added it to my project 9aftere removing the previous file name) and all seemed to be correct - i.e., the edits I had done were all in there. I then opened up the previous file, so that i could refer back to it (or revert, if necessary) and to my surprise, the OLD file had all of my recent edits in it. In other words, I now do not have a backup copy of that file. Hopefully I will not need it, but what might be happening here? Does S7 automatically save the file periodically? What about the error message? Doing a Google search seems to indicate that this is Visual Studio error, yet the new  file IS created,. Any ideas here? Could this be due to a misunderstanding of what Autorecover is supposed to do? My experience has been that when "save as" is selected, the old file is NOT changed.  

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Was your desired intention to simply rename a file in your project ?

 

If so what you should have done is:

  1. Select the file in Solution Explorer
  2. Press F2 (similar to F2 in regular Windows Explorer)
  3. Edit the filename
  4. Press enter (or otherwise lose focus)

 

I tried your steps in Visual studio 2017 (because that's what I'm working in at the moment) and I got no error. The result was exactly as I expected; my current file was saved as a new file in the directory I chose, and my project was left unchanged.

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 1

Are you sure you never hit Ctrl-S (as one tends to do as a matter of course sometimes) before you did the Save As.. ?

 

Anyway it sounds a LOT like you could benefit from using a revision control system. For standalone work I think SVN may be the easiest to use. If on Windows then you can get SVN with a very simple GUI interface by using TortoiseSVN.

 

When you use a revision control system like SVN then each time before a major editing session you can commit the files as they are now to storage. If you then do something that breaks the code or loses important file contents you can either completely roll-back the file to a previous version or you can merge in the bits you need from it.

Last Edited: Tue. Feb 4, 2020 - 10:28 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

clawson wrote:
For standalone work I think SVN may be the easiest to use.

I would agree.

 

If on Windows then you can get SVN with a very simple GUI interface by using TortoiseSVN.

Indeed - very simple & easy to use.

 

Top Tips:

  1. How to properly post source code - see: https://www.avrfreaks.net/comment... - also how to properly include images/pictures
  2. "Garbage" characters on a serial terminal are (almost?) invariably due to wrong baud rate - see: https://learn.sparkfun.com/tutorials/serial-communication
  3. Wrong baud rate is usually due to not running at the speed you thought; check by blinking a LED to see if you get the speed you expected
  4. Difference between a crystal, and a crystal oscillatorhttps://www.avrfreaks.net/comment...
  5. When your question is resolved, mark the solution: https://www.avrfreaks.net/comment...
  6. Beginner's "Getting Started" tips: https://www.avrfreaks.net/comment...
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

"Dare to be naïve." - Buckminster Fuller

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I guess I didn't explain myself clearly in my first post. With pretty much every application I use on my PC, if I open a file, edit it then use "Save as" to give it a new filename, the OLD file (the one I originally opened) is not changed. In other words, edits take place in RAM, and are written back to disk either with the original filename (if "Save" is used) or a NEW filename if "Save as" is used. Studio 7, on the surface, does not seem to follow this process, as it appears that it writes back to disk anything I do in the editor. Even apps that use an ongoing recovery process typically don't write to disk until the app is closed, so is the Studio 7 Autorecover writing back, or is there something else going on? I'm not hitting ctrl-S, and I did a very quick test to make sure that I was not doing anything from the keyboard that might provoke this kind of response.

I am also at a loss to explain the error message, especially since no other information is given, and the file is, in fact, generated in my folder. I realize that a version control system would be nice, but my projects are typically small, and I just assign a new serial number to the filename when I make changes.

I just did a little experiment where I opened a source file by itself, made a small edit, then "Saved as" a new filename, and the original file was preserved, so it looks as if the error and the odd editing behavior is only when a project is open.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 1

davetelling wrote:
my projects are typically small, and I just assign a new serial number to the filename when I make changes.

A friend lost many days work when he forgot what number he was on and overwrote a previous save, heed the advise above and get SVN, you will be glad you did!

 

Jim

 

 

(Possum Lodge oath) Quando omni flunkus, moritati.

"I thought growing old would take longer"

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

i did a little test.......

got the error and got the old file overwritten, so it indeed is a thing in studio.

 

what I did  was:

- opened a small test project I have with only a file called 'main.c'

- changed a little text in the main.c file

- then in the 'file' dropdown menu select "save 'main.s' as"

- you now I noticed that in the file name field the complete path is specified. should not be a problem though....

- press OK and you get the undefined error as the OP stated.

- AND a new file with the name is created AND the old file is also saved were it should not be saved.

 

interestingly I cannot reproduce the problem. I have restarted studio, created a new project all together, but the error does not seem to return.

I cannot restart my PC to see if Studio leaves something behind in memory. Will have to check tomorrow if I can reproduce the problem yet again then.

 

At first I thought it was the complete file name path mentioned, as on a second attempt were I removed the path and only kept the filename all was OK, but now not being able to reproduce the initial error makes me doubt that.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

davetelling wrote:

my projects are typically small, and I just assign a new serial number to the filename when I make changes.

I do that as well as using SVN !

 

ki0bk wrote:
 heed the advise above and get SVN, you will be glad you did!

Absolutely!

 

Among many other things, SVN gives you a full revision history, so you can trace back and see where things were changed - which is often useful when you don't notice that something's started going awry, or you've just forgotten when something was added/changed/removed.

 

(other revision control systems are available)

Top Tips:

  1. How to properly post source code - see: https://www.avrfreaks.net/comment... - also how to properly include images/pictures
  2. "Garbage" characters on a serial terminal are (almost?) invariably due to wrong baud rate - see: https://learn.sparkfun.com/tutorials/serial-communication
  3. Wrong baud rate is usually due to not running at the speed you thought; check by blinking a LED to see if you get the speed you expected
  4. Difference between a crystal, and a crystal oscillatorhttps://www.avrfreaks.net/comment...
  5. When your question is resolved, mark the solution: https://www.avrfreaks.net/comment...
  6. Beginner's "Getting Started" tips: https://www.avrfreaks.net/comment...