mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-18 08:06:04 +02:00
Relaxed project name restrictions. Auto-refresh of installed libraries.
This commit is contained in:
parent
b3354ee635
commit
4d55a32c90
6 changed files with 143 additions and 27 deletions
|
@ -1318,6 +1318,19 @@ namespace IDE
|
|||
options.mBuildOptions.mOtherLinkFlags.Set("$(LinkFlags)");
|
||||
}
|
||||
|
||||
public static void GetSanitizedName(String projectName, String outName, bool allowDot = false)
|
||||
{
|
||||
for (let c in projectName.RawChars)
|
||||
{
|
||||
if ((c.IsLetterOrDigit) || (c == '_'))
|
||||
outName.Append(c);
|
||||
else if (c == '-')
|
||||
outName.Append('_');
|
||||
else if ((c == '.') && (allowDot))
|
||||
outName.Append(c);
|
||||
}
|
||||
}
|
||||
|
||||
public this()
|
||||
{
|
||||
mRootFolder = new ProjectFolder();
|
||||
|
@ -1492,7 +1505,9 @@ namespace IDE
|
|||
data.Add("Name", mProjectName);
|
||||
data.ConditionalAdd("TargetType", mGeneralOptions.mTargetType, GetDefaultTargetType());
|
||||
data.ConditionalAdd("StartupObject", mBeefGlobalOptions.mStartupObject, IsSingleFile ? "Program" : "");
|
||||
data.ConditionalAdd("DefaultNamespace", mBeefGlobalOptions.mDefaultNamespace, mProjectName);
|
||||
var defaultNamespace = scope String();
|
||||
GetSanitizedName(mProjectName, defaultNamespace, true);
|
||||
data.ConditionalAdd("DefaultNamespace", mBeefGlobalOptions.mDefaultNamespace, defaultNamespace);
|
||||
WriteStrings("Aliases", mGeneralOptions.mAliases);
|
||||
WriteStrings("ProcessorMacros", mBeefGlobalOptions.mPreprocessorMacros);
|
||||
WriteDistinctOptions(mBeefGlobalOptions.mDistinctBuildOptions);
|
||||
|
@ -1807,7 +1822,9 @@ namespace IDE
|
|||
data.GetString("Name", mProjectName);
|
||||
ReadStrings("Aliases", mGeneralOptions.mAliases);
|
||||
data.GetString("StartupObject", mBeefGlobalOptions.mStartupObject, IsSingleFile ? "Program" : "");
|
||||
data.GetString("DefaultNamespace", mBeefGlobalOptions.mDefaultNamespace, mProjectName);
|
||||
var defaultNamespace = scope String();
|
||||
GetSanitizedName(mProjectName, defaultNamespace, true);
|
||||
data.GetString("DefaultNamespace", mBeefGlobalOptions.mDefaultNamespace, defaultNamespace);
|
||||
ReadStrings("ProcessorMacros", mBeefGlobalOptions.mPreprocessorMacros);
|
||||
for (data.Enumerate("DistinctOptions"))
|
||||
{
|
||||
|
@ -2317,7 +2334,8 @@ namespace IDE
|
|||
|
||||
public void SetupDefault(BeefGlobalOptions generalOptions)
|
||||
{
|
||||
generalOptions.mDefaultNamespace.Set(mProjectName);
|
||||
generalOptions.mDefaultNamespace.Clear();
|
||||
GetSanitizedName(mProjectName, generalOptions.mDefaultNamespace, true);
|
||||
generalOptions.mStartupObject.Set(scope String()..AppendF("{}.Program", generalOptions.mDefaultNamespace));
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue