-
Notifications
You must be signed in to change notification settings - Fork 154
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
【found solution】 Tags are not saved when publish or upload #296
Comments
I'm not familiar with c++, but I think it may be a cast error? |
I'm trying to log tags.m_ppStrings and it's empty
and then I found the log of greenworks/src/api/steam_api_workshop.cc And there are some commit look like have effect with tags |
Two months later, no one replay so I learned C++. And found there are two bugs need fix; No.1 steam_api_workshop.cc line 165 for (uint32_t i = 0; i < tags_array->Length(); ++i) {
if (!Nan::Get(tags_array, i).ToLocalChecked()->IsString())
THROW_BAD_ARGS("Bad arguments");
Nan::Utf8String tag(Nan::Get(tags_array, (i)).ToLocalChecked());
properties.tags_scratch.push_back(*tag);
properties.tags[i] = properties.tags_scratch.back().c_str(); // this line create the bug
}
I try like this: const char *a[4] = { "Blue", "Red",
"Orange", "Yellow" };
const char* tags[MAX_TAGS];
const char **p = new const char *[10];
vector<string> tags_scratch;
for (int i = 0; i < 4; ++i) {
cout << a[i] << endl;
tags_scratch.push_back(a[i]);
tags[i] = tags_scratch.back().c_str();
}
for (int i = 0; i < 4; ++i) {
cout << tags_scratch[i] << "\t";
cout << tags[i];
cout << endl;
}
and the cout is like this:
change the code like this will fix this bug for (int i = 0; i < 4; ++i) {
cout << a[i] << endl;
tags_scratch.push_back(a[i]);
tags[i] = tags_scratch.back().c_str();
}
for (int i = 0; i < tags_scratch.size(); ++i) {
tags[i] = tags_scratch[i].c_str();
} No.2 greenworks_workshop_workers.cc line 154 cout << properties_.tags << endl;
for(int tag = 0; tag < 1; ++tag)
{
cout << properties_.tags[tag] << ":\t";
} and the cout result is like this
I'm not sure about what makes the PublishWorkshopFileWorker::Execute run seems related to Nan::AsyncWorker , but I'm not familiar with c++ or Nan but it seems there is something error when AsyncWorker call the Execute and pass the value; |
And now my solution is like this // tags.m_ppStrings = reinterpret_cast<const char**>(&properties_.tags); replace this line as the flowing
tags.m_ppStrings = new const char *[tags.m_nNumStrings];
for (int i = 0; i < tags.m_nNumStrings; ++i) {
tags.m_ppStrings[i] = properties_.tags_scratch[i].c_str();
} It's a pity that no one maintains this project。 hope useful for you |
I want to publish tags with the workshop file, but it's not saved.
I look at the doc and find this function
so I just copy and modify like this
but sadly the tags are not saved
any idea?
The text was updated successfully, but these errors were encountered: