Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

migrate contents file on first properties access #1901

Merged
merged 1 commit into from Jan 3, 2018

Conversation

kevinushey
Copy link
Contributor

This should resolve #1623. I believe this is a candidate for the patch release. Copying motivation from that thread:


I was able to reproduce this issue in the following way.

  1. Create an RStudio project,
  2. Open that project with RStudio v1.0,
  3. Open a few files in that project,
  4. Shut down the IDE,
  5. Open the project with RStudio v1.1,
  6. Try editing one of the open files,
  7. Close and re-open RStudio v1.1,
  8. Notice that the open document is empty.

I think this is because we don't fully migrate to the new format on the first transfer of files. On the first open of RStudio v1.1, the sources folder looks like this:

$ tree
.
├── per
│   ├── t
│   └── u
├── prop
│   ├── 2646FB5C
│   ├── 28A9DEA3
│   ├── DC6A99FB
│   └── INDEX
└── s-F955001D
    ├── 244D0217
    ├── 88798333
    ├── FAE2342D
    └── lock_file

After a close + re-opening of the IDE, it looks like this:

$ tree
.
├── per
│   ├── t
│   └── u
├── prop
│   ├── 2646FB5C
│   ├── 28A9DEA3
│   ├── DC6A99FB
│   └── INDEX
└── s-1794F329
    ├── 244D0217
    ├── 244D0217-contents
    ├── 88798333
    ├── 88798333-contents
    ├── FAE2342D
    ├── FAE2342D-contents
    └── lock_file

Because those -contents files aren't populated on the first run, we end up with property files written out with no contents after an autosave. To mitigate this, we should extract the contents out of each properties file during migration and write the associated -contents file.

@kevinushey kevinushey force-pushed the bugfix/source-database-migration branch from 04daa91 to 0d4b1c7 Compare January 3, 2018 00:37
@@ -216,6 +216,32 @@ std::string pathFromProjectPath(json::Value projPathJson)
return std::string();
}

Error attemptContentsMigration(json::Object& propertiesJson,
const FilePath& propetiesPath)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: spelling (properties)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doh; thanks! Fixed with an amended commit.

@kevinushey kevinushey force-pushed the bugfix/source-database-migration branch from 0d4b1c7 to 906409e Compare January 3, 2018 01:46
@jmcphers jmcphers merged commit 7317a5b into master Jan 3, 2018
@valerie-rstudio valerie-rstudio deleted the bugfix/source-database-migration branch January 21, 2022 17:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Source pane displays non-empty R script as empty
2 participants