Skip to content

Commit

Permalink
Tiddy up the code and use unified conventions throughout the code.
Browse files Browse the repository at this point in the history
  • Loading branch information
Josh Roesslein committed Dec 23, 2010
1 parent 9af4b60 commit 21ff281
Show file tree
Hide file tree
Showing 421 changed files with 27,545 additions and 25,239 deletions.
397 changes: 190 additions & 207 deletions LICENSE

Large diffs are not rendered by default.

180 changes: 0 additions & 180 deletions modules/create.rb

This file was deleted.

65 changes: 65 additions & 0 deletions modules/ti.App/AppModule.cpp
@@ -0,0 +1,65 @@
/*
* Copyright (c) 2008-2010 Appcelerator, Inc. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

#include "AppModule.h"

#include <Poco/File.h>

#include "ApplicationConfig.h"
#include "Application.h"
#include "Properties.h"

namespace Titanium {

KROLL_MODULE(AppModule, STRING(MODULE_NAME), STRING(MODULE_VERSION));

static Logger* GetLogger()
{
static Logger* logger = Logger::Get("App");
return logger;
}

void AppModule::Initialize()
{
// Nudge the creation of the first app config instance.
ApplicationConfig* config = ApplicationConfig::Instance();
if (config)
GetLogger()->Debug("Loaded config file successfully");

KObjectRef global(host->GetGlobalObject());
KObjectRef binding = new Application(host, host->GetGlobalObject());
host->GetGlobalObject()->SetObject("App", binding);

// Create the data directory for the app, if it doesn't exist.
std::string dataPath(host->GetApplication()->GetDataPath());
Poco::File dataPathFile(dataPath);
if (!dataPathFile.exists())
dataPathFile.createDirectories();

std::string propFilename(FileUtils::Join(
dataPath.c_str(), "application.properties", 0));

// @tiapi(property=True,type=App.Properties,name=App.Properties,since=0.2)
// @tiapi The application's private Properties object
binding->SetObject("Properties", new Properties(propFilename));
}

void AppModule::Stop()
{
host->GetGlobalObject()->SetNull("App");
}

} // namespace Titanium
31 changes: 31 additions & 0 deletions modules/ti.App/AppModule.h
@@ -0,0 +1,31 @@
/*
* Copyright (c) 2008-2010 Appcelerator, Inc. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

#ifndef AppModule_h
#define AppModule_h

#include <kroll/kroll.h>

namespace Titanium {

class AppModule : public kroll::Module
{
KROLL_MODULE_CLASS(AppModule)
};

} // namespace Titanium

#endif

0 comments on commit 21ff281

Please sign in to comment.