Skip to content

Commit

Permalink
Fixes #157 Cannot load rSharp for users with accent in username #157 (#…
Browse files Browse the repository at this point in the history
…158)

Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Felix MIL <[email protected]>
  • Loading branch information
3 people authored Dec 10, 2024
1 parent 050b1c0 commit 6f2c391
Show file tree
Hide file tree
Showing 12 changed files with 31 additions and 23 deletions.
23 changes: 15 additions & 8 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
Package: rSharp
Type: Package
Title: Accessing .NET from R
Version: 1.0.0.9000
Authors@R: c(person(given = "Open-Systems-Pharmacology Community",
Version: 1.0.1
Authors@R: c(
person(given = "Open-Systems-Pharmacology Community",
role = "cph"),
person("esqLABS GmbH", role = "fnd"),
person(given = "Pavel",
Expand All @@ -15,16 +16,22 @@ Authors@R: c(person(given = "Open-Systems-Pharmacology Community",
comment = c(ORCID = "0000-0001-6922-588X")),
person(given = "Michael",
family = "Sevestre",
role = c("aut"),
role = "aut",
email = "[email protected]"),
person(given = "Robert",
family = "McIntosh",
role = c("aut")),
role = "aut"),
person(given = "Felix",
family = "Mil",
role = "aut"),
person(given = "Jean-Michel",
family = "Perraud",
email ="[email protected]",
role = "aut"),
person(given = "Ian Peter",
family = "Du",
role = c("aut")),
person("Jean-Michel", "Perraud", email =
"[email protected]", role = "aut"))
role = "ctb")
)
Description: Enable low-level access to .NET runtime from R. Provides a set of functions to create and manipulate .NET objects, call methods, and access properties and fields.
URL: https://github.com/Open-Systems-Pharmacology/rsharp/, http://www.open-systems-pharmacology.org/rSharp/
Encoding: UTF-8
Expand All @@ -40,6 +47,6 @@ Suggests:
knitr,
rmarkdown
License: file LICENSE
RoxygenNote: 7.3.1
RoxygenNote: 7.3.2
VignetteBuilder: knitr
Config/testthat/edition: 3
14 changes: 11 additions & 3 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
# rSharp (development version)
# rSharp 1.0.1

## Minor improvements and bug fixes

- Fixed a bug that prevented rSharp installation when the user had a R library
path containing special characters.


# rSharp 1.0.0

Expand All @@ -9,11 +15,13 @@
- github actions implementation for windows and Ubuntu R package builds.
- github actions for C# binary builds for windows and Ubuntu.

<!--
<!-- Section Template
## Minor improvements and bug fixes
## Breaking Changes
## Major changes
-->

2 changes: 1 addition & 1 deletion R/rSharp-env.R
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ rSharpEnv$testMethodBindingTypeName <- "ClrFacade.TestMethodBinding"
rSharpSettingNames <- names(rSharpEnv)

#' @title getRSharpSetting
#' @description Get the value of a global `{rSharp}` setting.
#' @description Get the value of a global rSharp setting.
#'
#' @param settingName String name of the setting
#'
Expand Down
Binary file modified inst/extdata/rSharp.Examples.dll
Binary file not shown.
Binary file modified inst/lib/ClrFacade.dll
Binary file not shown.
Binary file modified inst/lib/DynamicInterop.dll
Binary file not shown.
Binary file modified inst/lib/RDotNet.dll
Binary file not shown.
Binary file modified inst/lib/rSharp.dll
Binary file not shown.
Binary file modified inst/lib/rSharp.so
Binary file not shown.
2 changes: 1 addition & 1 deletion man/getRSharpSetting.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 2 additions & 9 deletions shared/rSharp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -79,12 +79,8 @@ SEXP rSharp_create_domain(SEXP args)

#ifdef WINDOWS
// STEP 2: Initialize and start the .NET Core runtime
size_t lengthInWideFormat = 0;
//Gets the length of libPath in terms of a wide string.
mbstowcs_s(&lengthInWideFormat, nullptr, 0, libraryPath, 0);
char_t* wideStringLibraryPath = new char_t[lengthInWideFormat + 1];
//Copies the libraryPath to a wchar_t with the size lengthInWideFormat
mbstowcs_s(nullptr, wideStringLibraryPath, lengthInWideFormat + 1, libraryPath, lengthInWideFormat);
std::wstring_convert<std::codecvt_utf8_utf16<wchar_t>> converter;
const char_t* wideStringLibraryPath = converter.from_bytes(libraryPath).c_str();
#else
const char_t* wideStringLibraryPath = libraryPath;
#endif
Expand All @@ -102,9 +98,6 @@ SEXP rSharp_create_domain(SEXP args)
}

delete[] wideStringPath;
#ifdef WINDOWS
delete[] wideStringLibraryPath;
#endif
}
catch (const std::exception& ex)
{
Expand Down
2 changes: 1 addition & 1 deletion shared/rSharp.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ typedef bool RSHARP_BOOL;
#define FALSE_BOOL false;

#ifdef WINDOWS

#include <codecvt>
#include <Windows.h>

#include <metahost.h>
Expand Down

0 comments on commit 6f2c391

Please sign in to comment.