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

Fixes Issue #242 - CPID Stuck on INVESTOR Due to invalid BOINC Data Path Detection #275

Merged
merged 14 commits into from Apr 17, 2017

Conversation

ghost
Copy link

@ghost ghost commented Apr 9, 2017

This still needs testing and may need some extra work to get it up to standards but it's the start of a fix for the BOINC data path issue.

@ghost ghost changed the title Fixes Issue/242 Fixes Issue/242 - CPID Stuck on INVESTOR Due to invalid BOINC Data Path Detection Apr 9, 2017
@tomasbrod
Copy link
Member

Why create a full class with constructor and multiple methods when a simple function would be sufficient?

@denravonska
Copy link
Member

@tonemackay Yes, this can be condensed down to just a function. A couple of notes:

  • I tried it in Win10 and it seems to just get the first character of the value in the registry. Possibly a unicode issue.
  • We can probably move the contents of GetBoincDataDir2 into this new function and remove the old one alltogether.
  • Add boinc.cpp to gridcoinresearch.pro the makefiles under src/. I'll try to make this less cumbersome.

@ghost
Copy link
Author

ghost commented Apr 10, 2017

My reasoning was so that the call to the registry etc only happens once and therefore multiple calls to GetBoincDataPath are cheap but I'm not sure how often it's called.

The DefaultBoincDataPathExists function was leftover from some testing I was doing and can be removed.

Maybe you are right and it's overkill especially if the function is only called once and should just go into main?

@denravonska
Copy link
Member

@tonemackay Keep the code in boinc.cpp. I want to move as much of the Gridcoin code out of main.cpp to organize things. I'' try to do an additional test this evening.

src/boinc.cpp Outdated
&dwSize) == ERROR_SUCCESS){
RegCloseKey(hKey);
std::wstring wsPath = szPath;
std::string path(wsPath.begin(),wsPath.end());
Copy link
Member

@denravonska denravonska Apr 11, 2017

Choose a reason for hiding this comment

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

This will fail on unicode systems but we probably want to use wstring for all file paths, so leave it for now.

src/main.cpp Outdated
@@ -242,7 +243,7 @@ std::string msMasterMessagePublicKey = "044b2938fbc38071f24bede21e838a0758a52a0

std::string BackupGridcoinWallet();
extern double GetPoSKernelPS2();
extern std::string GetBoincDataDir2();
extern std::string GetBoincDataDir();
Copy link
Member

Choose a reason for hiding this comment

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

This one can be removed.

@ghost ghost changed the title Fixes Issue/242 - CPID Stuck on INVESTOR Due to invalid BOINC Data Path Detection Fixes #242 - CPID Stuck on INVESTOR Due to invalid BOINC Data Path Detection Apr 11, 2017
@ghost ghost changed the title Fixes #242 - CPID Stuck on INVESTOR Due to invalid BOINC Data Path Detection Fixes Issue #242 - CPID Stuck on INVESTOR Due to invalid BOINC Data Path Detection Apr 11, 2017
@denravonska
Copy link
Member

Does anyone (@tomasbrod?) have an easy solution for the wstring->string issue? Otherwise we will merge this now and make all the file operations unicode later.

@tomasbrod
Copy link
Member

I dont @denravonska

@Peppernrino
Copy link
Contributor

Peppernrino commented Apr 11, 2017

for the record on github, i suggested in IRC to maybe make the whole thing UTF-8 as described in a stackoverflow thread. apparently you should only use wstring if you have a specific need for it.

@ghost
Copy link
Author

ghost commented Apr 11, 2017

@Peppernrino thanks for the link you posted in IRC. The issue I'm having is the function call to the Windows registry returns wstring and converting it to a normal string is a bitch.

@denravonska I've tried using WideCharToMultiByte and also tried boost local but both methods don't seem to work. The boost filesystem exists function returns false.

@philipswift
Copy link

Maybe note and disregard that users can install to different drives and paths. A Win scenario is primary drive C is low on spare capacity so users path to a second drive (mapped or direct). They can create their own installation folder then install to that. They can do this for BOINC and Gridcoin for both data and applications. Considering the frequency of this scenario is low, go round it maybe but note it and caveat for it (about Gridcoin>'this is test software' or Gridcoin EULA (End User License Agreement) https://www.eff.org/wp/dangerous-terms-users-guide-eulas.

@philipswift
Copy link

@denravonska http://stackoverflow.com/questions/4358870/convert-wstring-to-string-encoded-in-utf-8

@denravonska denravonska merged commit eb55131 into gridcoin-community:development Apr 17, 2017
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.

4 participants